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

Unified Diff: test/snippets.js

Issue 29853555: Issue 6853 - Add unit tests for quirks in snippet script parsing (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 11, 2018, 6:16 a.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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/snippets.js
===================================================================
--- a/test/snippets.js
+++ b/test/snippets.js
@@ -183,16 +183,44 @@
[["foo"], ["bar", "1"]]);
checkParsedScript("Script with blank argument in the middle", "foo '' Hello",
[["foo", "", "Hello"]]);
checkParsedScript("Script with blank argument at the end", "foo Hello ''",
[["foo", "Hello", ""]]);
checkParsedScript("Script with consecutive blank arguments", "foo '' ''",
[["foo", "", ""]]);
+ // Undocumented quirks (#6853).
+ checkParsedScript("Script with quotes within an argument", "foo Hello''world",
+ [["foo", "Helloworld"]]);
+ checkParsedScript("Script with quotes within an argument containing whitespace",
+ "foo Hello' 'world",
+ [["foo", "Hello world"]]);
+ checkParsedScript("Script with quotes within an argument containing non-whitespace",
+ "foo Hello','world",
+ [["foo", "Hello,world"]]);
+ checkParsedScript("Script with quotes within an argument containing whitespace and non-whitespace",
+ "foo Hello', 'world",
+ [["foo", "Hello, world"]]);
+ checkParsedScript("Script with opening quote at the beginning of an argument",
+ "foo 'Hello, 'world",
+ [["foo", "Hello, world"]]);
+ checkParsedScript("Script with closing quote at the end of an argument",
+ "foo Hello,' world'",
+ [["foo", "Hello, world"]]);
+
+ checkParsedScript("Script with closing quote missing", "foo 'Hello, world",
+ []);
+ checkParsedScript("Script with closing quote missing in last command",
+ "foo Hello; bar 'How are you?",
+ [["foo", "Hello"]]);
+ checkParsedScript("Script ending with a backslash",
+ "foo Hello; bar 'How are you?' \\",
+ [["foo", "Hello"]]);
+
test.done();
};
exports.testScriptCompilation = function(test)
{
let libraries = [
`
let foo = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld