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

Unified Diff: test/regexpFilters_matching.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Patch Set: Rebased. Created Feb. 28, 2017, 3:55 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
Index: test/regexpFilters_matching.js
diff --git a/test/regexpFilters_matching.js b/test/regexpFilters_matching.js
index 8017945dece3c8853665ef668be1446d22647eaa..7135596eb55e03bc5ae3de9523d8743ac9e0c1b6 100644
--- a/test/regexpFilters_matching.js
+++ b/test/regexpFilters_matching.js
@@ -17,7 +17,7 @@
"use strict";
-let {createSandbox} = require("./_common");
+const {createSandbox} = require("./_common");
let Filter = null;
let RegExpFilter = null;
@@ -34,17 +34,18 @@ exports.setUp = function(callback)
+function testMatchInternal(test, text, location, contentType, docDomain, thirdParty, sitekey, expected)
+{
+ let filter = Filter.fromText(text);
+ let result = filter.matches(location, RegExpFilter.typeMap[contentType], docDomain, thirdParty, sitekey);
+ test.equal(!!result, expected, '"' + text + '".matches(' + location + ", " + contentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " + (sitekey || "no-sitekey") + ")");
+}
Wladimir Palant 2017/03/02 14:07:08 Why move an internal function outside the function
kzar 2017/03/08 12:33:56 I did this since we were violating no-shadow for t
+
function testMatch(test, text, location, contentType, docDomain, thirdParty, sitekey, expected)
{
- function testMatch_internal(text, location, contentType, docDomain, thirdParty, sitekey, expected)
- {
- let filter = Filter.fromText(text);
- let result = filter.matches(location, RegExpFilter.typeMap[contentType], docDomain, thirdParty, sitekey);
- test.equal(!!result, expected, '"' + text + '".matches(' + location + ", " + contentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " + (sitekey || "no-sitekey") + ")");
- }
- testMatch_internal(text, location, contentType, docDomain, thirdParty, sitekey, expected);
+ testMatchInternal(test, text, location, contentType, docDomain, thirdParty, sitekey, expected);
if (!/^@@/.test(text))
- testMatch_internal("@@" + text, location, contentType, docDomain, thirdParty, sitekey, expected);
+ testMatchInternal(test, "@@" + text, location, contentType, docDomain, thirdParty, sitekey, expected);
}
exports.testBasicFilters = function(test)

Powered by Google App Engine
This is Rietveld