diff options
author | kzc <zaxxon2011@gmail.com> | 2016-03-24 11:51:54 -0400 |
---|---|---|
committer | kzc <zaxxon2011@gmail.com> | 2016-03-24 11:51:54 -0400 |
commit | 07bb7262d02547cef5ffaca71d49c86640a1df15 (patch) | |
tree | 00e9c98a271bed172168333e843d007d2a681afb /test | |
parent | ee6c9fabb7dc00b8bbc9e60859767acc585cd0fa (diff) | |
download | tracifyjs-07bb7262d02547cef5ffaca71d49c86640a1df15.tar.gz tracifyjs-07bb7262d02547cef5ffaca71d49c86640a1df15.zip |
Escape all ASCII control characters within strings when using ascii_only.
Fixes #1017.
Tab characters within strings are now output as `\t` in all output modes.
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/ascii.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/ascii.js b/test/compress/ascii.js new file mode 100644 index 00000000..5c6b3b8e --- /dev/null +++ b/test/compress/ascii.js @@ -0,0 +1,32 @@ +ascii_only_true: { + options = {} + beautify = { + ascii_only : true, + beautify : false, + } + input: { + function f() { + return "\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\'}' +} + +ascii_only_false: { + options = {} + beautify = { + ascii_only : false, + beautify : false, + } + input: { + function f() { + return "\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\'}' +} + |