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

Unified Diff: test/elemHideEmulation.js

Issue 29594607: Issue 5143 - Convert ElemHideEmulation to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebased. Created Dec. 5, 2017, 6:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« compiled/ElemHideEmulation.cpp ('K') | « meson.build ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/elemHideEmulation.js
===================================================================
--- a/test/elemHideEmulation.js
+++ b/test/elemHideEmulation.js
@@ -125,19 +125,27 @@
{
let filter = Filter.fromText(text);
if (filter instanceof ElemHideEmulationFilter)
ElemHideEmulation.add(filter);
else
ElemHide.add(filter);
filter.delete();
}
- let matches = ElemHideEmulation.getRulesForDomain(domain)
- .map(filter => filter.text);
+
+ let rules = ElemHideEmulation.getRulesForDomain(domain);
+ let matches = [];
+ for (let i = 0; i < rules.filterCount; i++)
+ {
+ let filter = rules.filterAt(i);
+ matches.push(filter.text);
+ filter.delete();
+ }
test.deepEqual(matches.sort(), expectedMatches.sort(), description);
+ rules.delete();
ElemHideEmulation.clear();
ElemHide.clear();
}
testSelectorMatches(
"Ignore generic filters",
[
@@ -186,20 +194,28 @@
test.done();
};
exports.testElemHideEmulationFiltersContainer = function(test)
{
function compareRules(description, domain, expectedMatches)
{
- let result = ElemHideEmulation.getRulesForDomain(domain)
- .map(filter => filter.text);
+ let rules = ElemHideEmulation.getRulesForDomain(domain);
+ let result = [];
+ for (let i = 0; i < rules.filterCount; i++)
+ {
+ let filter = rules.filterAt(i);
+ result.push(filter.text);
+ filter.delete();
+ }
expectedMatches = expectedMatches.map(filter => filter.text);
test.deepEqual(result.sort(), expectedMatches.sort(), description);
+
+ rules.delete();
}
let domainFilter = Filter.fromText("example.com##filter1");
let subdomainFilter = Filter.fromText("www.example.com##filter2");
let otherDomainFilter = Filter.fromText("other.example.com##filter3");
ElemHideEmulation.add(domainFilter);
ElemHideEmulation.add(subdomainFilter);
« compiled/ElemHideEmulation.cpp ('K') | « meson.build ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld