Index: test/filterClasses.js |
=================================================================== |
--- a/test/filterClasses.js |
+++ b/test/filterClasses.js |
@@ -70,34 +70,32 @@ |
["foobar##asdf{asdf}", BlockingFilter, "blocking"], |
["foobar##", BlockingFilter, "blocking"], |
["foobar#@#", BlockingFilter, "blocking"], |
["asdf$foobar", InvalidFilter, "invalid"], |
["asdf$image,foobar", InvalidFilter, "invalid"], |
["asdf$image=foobar", BlockingFilter, "blocking"], |
["asdf$image=foobar=xyz,~collapse", BlockingFilter, "blocking"], |
- ["##foo[-abp-properties='something']bar", InvalidFilter, "invalid"], |
- ["#@#foo[-abp-properties='something']bar", ElemHideException, "elemhideexception"], |
- ["example.com##foo[-abp-properties='something']bar", ElemHideEmulationFilter, "elemhideemulation"], |
- ["example.com#@#foo[-abp-properties='something']bar", ElemHideException, "elemhideexception"], |
- ["~example.com##foo[-abp-properties='something']bar", InvalidFilter, "invalid"], |
- ["~example.com#@#foo[-abp-properties='something']bar", ElemHideException, "elemhideexception"], |
- ["~example.com,~example.info##foo[-abp-properties='something']bar", InvalidFilter, "invalid"], |
- ["~example.com,~example.info#@#foo[-abp-properties='something']bar", ElemHideException, "elemhideexception"], |
- ["~sub.example.com,example.com##foo[-abp-properties='something']bar", ElemHideEmulationFilter, "elemhideemulation"], |
- ["~sub.example.com,example.com#@#foo[-abp-properties='something']bar", ElemHideException, "elemhideexception"], |
- ["example.com,~sub.example.com##foo[-abp-properties='something']bar", ElemHideEmulationFilter, "elemhideemulation"], |
- ["example.com,~sub.example.com#@#foo[-abp-properties='something']bar", ElemHideException, "elemhideexception"], |
- ["example.com##[-abp-properties='something']", ElemHideEmulationFilter, "elemhideemulation"], |
- ["example.com#@#[-abp-properties='something']", ElemHideException, "elemhideexception"], |
- ["example.com##[-abp-properties=\"something\"]", ElemHideEmulationFilter, "elemhideemulation"], |
- ["example.com#@#[-abp-properties=\"something\"]", ElemHideException, "elemhideexception"], |
- ["example.com##[-abp-properties=(something)]", ElemHideEmulationFilter, "elemhideemulation"], |
- ["example.com#@#[-abp-properties=(something)]", ElemHideException, "elemhideexception"] |
+ ["#?#foo:-abp-properties(something)bar", InvalidFilter, "invalid"], |
+ ["#@#foo:-abp-properties(something)bar", ElemHideException, "elemhideexception"], |
+ ["example.com#?#foo:-abp-properties(something)bar", ElemHideEmulationFilter, "elemhideemulation"], |
+ ["example.com#@#foo:-abp-properties(something)bar", ElemHideException, "elemhideexception"], |
+ ["~example.com#?#foo:-abp-properties(something)bar", InvalidFilter, "invalid"], |
+ ["~example.com#@#foo:-abp-properties(something)bar", ElemHideException, "elemhideexception"], |
+ ["~example.com,~example.info#?#foo:-abp-properties(something)bar", InvalidFilter, "invalid"], |
+ ["~example.com,~example.info#@#foo:-abp-properties(something)bar", ElemHideException, "elemhideexception"], |
+ ["~sub.example.com,example.com#?#foo:-abp-properties(something)bar", ElemHideEmulationFilter, "elemhideemulation"], |
+ ["~sub.example.com,example.com#@#foo:-abp-properties(something)bar", ElemHideException, "elemhideexception"], |
+ ["example.com,~sub.example.com#?#foo:-abp-properties(something)bar", ElemHideEmulationFilter, "elemhideemulation"], |
+ ["example.com,~sub.example.com#@#foo:-abp-properties(something)bar", ElemHideException, "elemhideexception"], |
+ ["example.com#?#:-abp-properties(something)", ElemHideEmulationFilter, "elemhideemulation"], |
+ ["example.com#@#:-abp-properties(something)", ElemHideException, "elemhideexception"], |
+ ["example.com#?#:-abp-properties((something))", ElemHideEmulationFilter, "elemhideemulation"], |
+ ["example.com#@#:-abp-properties((something))", ElemHideException, "elemhideexception"] |
]; |
for (let [text, type, typeName] of tests) |
{ |
let filter = Filter.fromText(text); |
test.ok(filter instanceof Filter, "Got filter for " + text); |
test.equal(filter.text, text, "Correct filter text for " + text); |
test.ok(filter instanceof type, "Correct filter type for " + text); |
test.equal(filter.type, typeName, "Type name for " + text + " is " + typeName); |
@@ -117,17 +115,17 @@ |
]; |
let tests = [ |
["/asdf??+/", Filter, InvalidFilter], |
["!asdf", Filter, CommentFilter], |
["asdf", Filter, ActiveFilter, RegExpFilter, BlockingFilter], |
["@@asdf", Filter, ActiveFilter, RegExpFilter, WhitelistFilter], |
["##asdf", Filter, ActiveFilter, ElemHideBase, ElemHideFilter], |
["#@#asdf", Filter, ActiveFilter, ElemHideBase, ElemHideException], |
- ["example.com##[-abp-properties='something']", Filter, ActiveFilter, ElemHideBase, ElemHideEmulationFilter] |
+ ["example.com#?#[-abp-properties='something']", Filter, ActiveFilter, ElemHideBase, ElemHideEmulationFilter] |
]; |
for (let list of tests) |
{ |
let filter = Filter.fromText(list.shift()); |
for (let cls of list) |
{ |
test.ok(filter instanceof cls, |
@@ -264,17 +262,17 @@ |
test.done(); |
}; |
exports.testInvalidReasons = function(test) |
{ |
let tests = [ |
["/??/", "filter_invalid_regexp"], |
["asd$foobar", "filter_unknown_option"], |
- ["~foo.com##[-abp-properties='abc']", "filter_elemhideemulation_nodomain"] |
+ ["~foo.com#?#[-abp-properties='abc']", "filter_elemhideemulation_nodomain"] |
]; |
for (let [text, reason] of tests) |
{ |
let filter = Filter.fromText(text); |
test.equals(filter.reason, reason, "Reason why filter " + text + " is invalid"); |
filter.delete(); |
} |