aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bau <david.bau@gmail.com>2013-12-23 16:05:04 +0000
committerRichard van Velzen <rvanvelzen@experty.com>2016-06-12 14:32:32 +0200
commitf99b7b630daf85f85393d4508e2676456f2a3c4b (patch)
tree2a0413002882324028f6ef568b4224c77a354cbf /test
parentea31da24559b095a18f7615cfd3c992ecaf495a3 (diff)
downloadtracifyjs-f99b7b630daf85f85393d4508e2676456f2a3c4b.tar.gz
tracifyjs-f99b7b630daf85f85393d4508e2676456f2a3c4b.zip
Escape null characters as \0 unless followed by 0-7.
Diffstat (limited to 'test')
-rw-r--r--test/compress/ascii.js10
-rw-r--r--test/compress/concat-strings.js4
2 files changed, 10 insertions, 4 deletions
diff --git a/test/compress/ascii.js b/test/compress/ascii.js
index 5c6b3b8e..7686ac3f 100644
--- a/test/compress/ascii.js
+++ b/test/compress/ascii.js
@@ -6,12 +6,13 @@ ascii_only_true: {
}
input: {
function f() {
- return "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" +
+ return "\x000\x001\x007\x008\x00" +
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" +
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" +
"\x20\x21\x22\x23 ... \x7d\x7e\x7f\x80\x81 ... \xfe\xff\u0fff\uffff";
}
}
- expect_exact: 'function f(){return"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\b\\t\\n\\x0B\\f\\r\\x0e\\x0f"+"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f"+\' !"# ... }~\\x7f\\x80\\x81 ... \\xfe\\xff\\u0fff\\uffff\'}'
+ expect_exact: 'function f(){return"\\x000\\x001\\x007\\08\\0"+"\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\b\\t\\n\\x0B\\f\\r\\x0e\\x0f"+"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f"+\' !"# ... }~\\x7f\\x80\\x81 ... \\xfe\\xff\\u0fff\\uffff\'}'
}
ascii_only_false: {
@@ -22,11 +23,12 @@ ascii_only_false: {
}
input: {
function f() {
- return "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" +
+ return "\x000\x001\x007\x008\x00" +
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" +
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" +
"\x20\x21\x22\x23 ... \x7d\x7e\x7f\x80\x81 ... \xfe\xff\u0fff\uffff";
}
}
- expect_exact: 'function f(){return"\\x00\x01\x02\x03\x04\x05\x06\x07\\b\\t\\n\\x0B\\f\\r\x0e\x0f"+"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"+\' !"# ... }~\x7f\x80\x81 ... \xfe\xff\u0fff\uffff\'}'
+ expect_exact: 'function f(){return"\\x000\\x001\\x007\\08\\0"+"\\0\x01\x02\x03\x04\x05\x06\x07\\b\\t\\n\\x0B\\f\\r\x0e\x0f"+"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"+\' !"# ... }~\x7f\x80\x81 ... \xfe\xff\u0fff\uffff\'}'
}
diff --git a/test/compress/concat-strings.js b/test/compress/concat-strings.js
index 79192987..50eef8b8 100644
--- a/test/compress/concat-strings.js
+++ b/test/compress/concat-strings.js
@@ -11,6 +11,9 @@ concat_1: {
var d = 1 + x() + 2 + 3 + "boo";
var e = 1 + x() + 2 + "X" + 3 + "boo";
+
+ // be careful with concatentation with "\0" with octal-looking strings.
+ var f = "\0" + 360 + "\0" + 8 + "\0";
}
expect: {
var a = "foobar" + x() + "moofoo" + y() + "xyz" + q();
@@ -18,5 +21,6 @@ concat_1: {
var c = 1 + x() + 2 + "boo";
var d = 1 + x() + 2 + 3 + "boo";
var e = 1 + x() + 2 + "X3boo";
+ var f = "\x00360\08\0";
}
}