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

Delta Between Two Patch Sets: test/filterClasses.js

Issue 29573044: Issue 5147 - Invalidate wrapper on delete (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Added tests Created Oct. 11, 2017, 12:49 p.m.
Right Patch Set: tweaked the test. Created Oct. 11, 2017, 2:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/bindings/generator.cpp ('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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 filter1.hitCount = 432; 156 filter1.hitCount = 432;
157 157
158 let filter2 = Filter.fromText("someknownfilter"); 158 let filter2 = Filter.fromText("someknownfilter");
159 test.equal(filter2.hitCount, 432, "Known filter returned"); 159 test.equal(filter2.hitCount, 432, "Known filter returned");
160 160
161 filter2.hitCount = 234; 161 filter2.hitCount = 234;
162 test.equal(filter1.hitCount, 234, "Changing second wrapper modifies original a s well"); 162 test.equal(filter1.hitCount, 234, "Changing second wrapper modifies original a s well");
163 163
164 filter1.delete(); 164 filter1.delete();
165
166 test.throws(() => { filter1.delete(); });
167 test.throws(() => { filter1.hitCount; });
168 test.throws(() => { filter1._pointer; });
169
165 filter2.delete(); 170 filter2.delete();
166
167 test.throws(() => { filter1.delete() == 0; });
sergei 2017/10/11 12:52:55 What about putting them into a separate test?
sergei 2017/10/11 12:52:56 IMO it would be better to remove these comparisons
hub 2017/10/11 14:47:01 I don't know was I put the '== 0' here. I think t
168 test.throws(() => { filter1.hitCount == 0; });
169 test.throws(() => { filter1._pointer == 0xdeadbeef; });
Wladimir Palant 2017/10/11 13:51:52 I agree, comparisons aren't necessary. Also, you s
hub 2017/10/11 14:47:01 Done.
170 171
171 let filter3 = Filter.fromText("someknownfilter"); 172 let filter3 = Filter.fromText("someknownfilter");
172 test.equal(filter3.hitCount, 0, "Filter data has been reset once previous inst ances have been released"); 173 test.equal(filter3.hitCount, 0, "Filter data has been reset once previous inst ances have been released");
173 filter3.delete(); 174 filter3.delete();
174 175
175 test.done(); 176 test.done();
176 }; 177 };
177 178
178 exports.testNormalize = function(test) 179 exports.testNormalize = function(test)
179 { 180 {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 filter.hitCount++; 429 filter.hitCount++;
429 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); 430 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts");
430 checkNotifications(() => 431 checkNotifications(() =>
431 { 432 {
432 filter.hitCount = 0; 433 filter.hitCount = 0;
433 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); 434 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts");
434 435
435 filter.delete(); 436 filter.delete();
436 test.done(); 437 test.done();
437 }; 438 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld