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

Side by Side Diff: test/filterStorage_readwrite.js

Issue 30013625: Issue 7094 - Link filters with subscriptions in INI parser (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Minor formatting change Created Feb. 22, 2019, 2:55 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 | « lib/iniParser.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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 let importer = filterStorage.importData(); 177 let importer = filterStorage.importData();
178 for (let line of lines) 178 for (let line of lines)
179 importer(line); 179 importer(line);
180 importer(null); 180 importer(null);
181 181
182 test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion , "File format version"); 182 test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion , "File format version");
183 183
184 let exported = Array.from(filterStorage.exportData()); 184 let exported = Array.from(filterStorage.exportData());
185 test.deepEqual(canonize(exported), canonize(lines), "Import/export result"); 185 test.deepEqual(canonize(exported), canonize(lines), "Import/export result");
186
187 // Make sure the relationships between filters and subscriptions are set
188 // up.
189 for (let subscription of filterStorage.subscriptions())
190 {
191 for (let text of subscription.filterText())
192 {
193 let found = false;
194
195 for (let filterSubscription of Filter.fromText(text).subscriptions())
196 {
197 if (filterSubscription == subscription)
198 {
199 found = true;
200 break;
201 }
202 }
203
204 test.ok(found, "Filter " + JSON.stringify(text) + " " +
205 "should be linked to its subscription " +
206 subscription.url);
hub 2019/02/22 15:28:04 I think using a template string here would be clea
Manish Jethani 2019/02/22 15:48:38 Done.
207 }
208 }
186 } 209 }
187 catch (error) 210 catch (error)
188 { 211 {
189 unexpectedError.call(test, error); 212 unexpectedError.call(test, error);
190 } 213 }
191 214
192 test.done(); 215 test.done();
193 }; 216 };
194 217
195 exports.testSavingWithoutBackups = async function(test) 218 exports.testSavingWithoutBackups = async function(test)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 316
294 test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter cou nt after reloading"); 317 test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter cou nt after reloading");
295 } 318 }
296 catch (error) 319 catch (error)
297 { 320 {
298 unexpectedError.call(test, error); 321 unexpectedError.call(test, error);
299 } 322 }
300 323
301 test.done(); 324 test.done();
302 }; 325 };
OLDNEW
« no previous file with comments | « lib/iniParser.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld