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

Delta Between Two Patch Sets: test/filterStorage_readwrite.js

Issue 30013625: Issue 7094 - Link filters with subscriptions in INI parser (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Feb. 22, 2019, 1:28 a.m.
Right Patch Set: Use template string Created Feb. 22, 2019, 3:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « lib/iniParser.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 ${text} should be linked to subscription ${subscr iption.url}`);
205 }
206 }
186 } 207 }
187 catch (error) 208 catch (error)
188 { 209 {
189 unexpectedError.call(test, error); 210 unexpectedError.call(test, error);
190 } 211 }
191 212
192 test.done(); 213 test.done();
193 }; 214 };
194 215
195 exports.testSavingWithoutBackups = async function(test) 216 exports.testSavingWithoutBackups = async function(test)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 314
294 test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter cou nt after reloading"); 315 test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter cou nt after reloading");
295 } 316 }
296 catch (error) 317 catch (error)
297 { 318 {
298 unexpectedError.call(test, error); 319 unexpectedError.call(test, error);
299 } 320 }
300 321
301 test.done(); 322 test.done();
302 }; 323 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld