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

Side by Side Diff: test/filterClasses.js

Issue 29573044: Issue 5147 - Invalidate wrapper on delete (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Added tests Created Oct. 11, 2017, 12:49 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 | « compiled/bindings/generator.cpp ('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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 filter2.delete(); 165 filter2.delete();
166 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
167 let filter3 = Filter.fromText("someknownfilter"); 171 let filter3 = Filter.fromText("someknownfilter");
168 test.equal(filter3.hitCount, 0, "Filter data has been reset once previous inst ances have been released"); 172 test.equal(filter3.hitCount, 0, "Filter data has been reset once previous inst ances have been released");
169 filter3.delete(); 173 filter3.delete();
170 174
171 test.done(); 175 test.done();
172 }; 176 };
173 177
174 exports.testNormalize = function(test) 178 exports.testNormalize = function(test)
175 { 179 {
176 let tests = [ 180 let tests = [
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 filter.hitCount++; 428 filter.hitCount++;
425 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); 429 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts");
426 checkNotifications(() => 430 checkNotifications(() =>
427 { 431 {
428 filter.hitCount = 0; 432 filter.hitCount = 0;
429 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); 433 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts");
430 434
431 filter.delete(); 435 filter.delete();
432 test.done(); 436 test.done();
433 }; 437 };
OLDNEW
« no previous file with comments | « compiled/bindings/generator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld