OLD | NEW |
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 Loading... |
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 | 171 |
167 let filter3 = Filter.fromText("someknownfilter"); | 172 let filter3 = Filter.fromText("someknownfilter"); |
168 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"); |
169 filter3.delete(); | 174 filter3.delete(); |
170 | 175 |
171 test.done(); | 176 test.done(); |
172 }; | 177 }; |
173 | 178 |
174 exports.testNormalize = function(test) | 179 exports.testNormalize = function(test) |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 filter.hitCount++; | 429 filter.hitCount++; |
425 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); | 430 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); |
426 checkNotifications(() => | 431 checkNotifications(() => |
427 { | 432 { |
428 filter.hitCount = 0; | 433 filter.hitCount = 0; |
429 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); | 434 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); |
430 | 435 |
431 filter.delete(); | 436 filter.delete(); |
432 test.done(); | 437 test.done(); |
433 }; | 438 }; |
OLD | NEW |