Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/subscriptionClasses.js

Issue 29802575: Issue 6559 - Replace fromObject with fromMap (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 8, 2018, 1:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/filterStorage_readwrite.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 29 matching lines...) Expand all
40 function compareSubscription(test, url, expected, postInit) 40 function compareSubscription(test, url, expected, postInit)
41 { 41 {
42 expected.push("[Subscription]"); 42 expected.push("[Subscription]");
43 let subscription = Subscription.fromURL(url); 43 let subscription = Subscription.fromURL(url);
44 if (postInit) 44 if (postInit)
45 postInit(subscription); 45 postInit(subscription);
46 let result = []; 46 let result = [];
47 subscription.serialize(result); 47 subscription.serialize(result);
48 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); 48 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url);
49 49
50 let map = Object.create(null); 50 let map = new Map();
51 for (let line of result.slice(1)) 51 for (let line of result.slice(1))
52 { 52 {
53 if (/(.*?)=(.*)/.test(line)) 53 if (/(.*?)=(.*)/.test(line))
54 map[RegExp.$1] = RegExp.$2; 54 map.set(RegExp.$1, RegExp.$2);
55 } 55 }
56 let subscription2 = Subscription.fromObject(map); 56 let subscription2 = Subscription.fromMap(map);
57 test.equal(subscription.toString(), subscription2.toString(), url + " deserial ization"); 57 test.equal(subscription.toString(), subscription2.toString(), url + " deserial ization");
58 } 58 }
59 59
60 exports.testSubscriptionClassDefinitions = function(test) 60 exports.testSubscriptionClassDefinitions = function(test)
61 { 61 {
62 test.equal(typeof Subscription, "function", "typeof Subscription"); 62 test.equal(typeof Subscription, "function", "typeof Subscription");
63 test.equal(typeof SpecialSubscription, "function", "typeof SpecialSubscription "); 63 test.equal(typeof SpecialSubscription, "function", "typeof SpecialSubscription ");
64 test.equal(typeof RegularSubscription, "function", "typeof RegularSubscription "); 64 test.equal(typeof RegularSubscription, "function", "typeof RegularSubscription ");
65 test.equal(typeof ExternalSubscription, "function", "typeof ExternalSubscripti on"); 65 test.equal(typeof ExternalSubscription, "function", "typeof ExternalSubscripti on");
66 test.equal(typeof DownloadableSubscription, "function", "typeof DownloadableSu bscription"); 66 test.equal(typeof DownloadableSubscription, "function", "typeof DownloadableSu bscription");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 test, "~wl~", ["url=~wl~", "disabled=true", "title=Test group"], 106 test, "~wl~", ["url=~wl~", "disabled=true", "title=Test group"],
107 subscription => 107 subscription =>
108 { 108 {
109 subscription.title = "Test group"; 109 subscription.title = "Test group";
110 subscription.disabled = true; 110 subscription.disabled = true;
111 } 111 }
112 ); 112 );
113 113
114 test.done(); 114 test.done();
115 }; 115 };
OLDNEW
« no previous file with comments | « test/filterStorage_readwrite.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld