diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-19 02:34:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 09:34:17 +0800 |
commit | 8ecaa40c6e7c9936476b22e994947982a40e0b50 (patch) | |
tree | 6d2d9510a23541541aa98996f9ecc6026cdf1efc /test/compress | |
parent | 96bf7fceabf1670ca07c08a04a3130e742775c8f (diff) | |
download | tracifyjs-8ecaa40c6e7c9936476b22e994947982a40e0b50.tar.gz tracifyjs-8ecaa40c6e7c9936476b22e994947982a40e0b50.zip |
extend support for Unicode (#4228)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/ascii.js | 35 | ||||
-rw-r--r-- | test/compress/unicode.js | 66 |
2 files changed, 66 insertions, 35 deletions
diff --git a/test/compress/ascii.js b/test/compress/ascii.js deleted file mode 100644 index 3c7cc5cf..00000000 --- a/test/compress/ascii.js +++ /dev/null @@ -1,35 +0,0 @@ -ascii_only_true: { - options = {} - beautify = { - ascii_only : true, - ie8 : false, - beautify : false, - } - input: { - function f() { - 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"\\x000\\x001\\x007\\x008\\0"+"\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\b\\t\\n\\v\\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, - ie8 : false, - beautify : false, - } - input: { - function f() { - 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"\\x000\\x001\\x007\\x008\\0"+"\\0\x01\x02\x03\x04\x05\x06\x07\\b\\t\\n\\v\\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/unicode.js b/test/compress/unicode.js index a94dc739..be86ccd8 100644 --- a/test/compress/unicode.js +++ b/test/compress/unicode.js @@ -1,3 +1,37 @@ +ascii_only_false: { + options = {} + beautify = { + ascii_only: false, + } + input: { + console.log( + "\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: 'console.log("\\x000\\x001\\x007\\x008\\0","\\0\x01\x02\x03\x04\x05\x06\x07\\b\\t\\n\\v\\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_stdout: true +} + +ascii_only_true: { + options = {} + beautify = { + ascii_only: true, + } + input: { + console.log( + "\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: 'console.log("\\x000\\x001\\x007\\x008\\0","\\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\b\\t\\n\\v\\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_stdout: true +} + unicode_parse_variables: { options = {} input: { @@ -141,3 +175,35 @@ issue_2569: { } expect_exact: 'new RegExp("[\\udc42-\\udcaa\\udd74-\\udd96\\ude45-\\ude4f\\udea3-\\udecc]");' } + +surrogate_pair: { + beautify = { + ascii_only: false, + } + input: { + var \u{2f800} = { + \u{2f801}: "\u{100000}", + }; + \u{2f800}.\u{2f802} = "\u{100001}"; + console.log(typeof \u{2f800}, \u{2f800}.\u{2f801}, \u{2f800}["\u{2f802}"]); + } + expect_exact: 'var \ud87e\udc00={"\ud87e\udc01":"\udbc0\udc00"};\ud87e\udc00.\ud87e\udc02="\udbc0\udc01";console.log(typeof \ud87e\udc00,\ud87e\udc00.\ud87e\udc01,\ud87e\udc00["\ud87e\udc02"]);' + expect_stdout: "object \udbc0\udc00 \udbc0\udc01" + node_version: ">=4" +} + +surrogate_pair_ascii: { + beautify = { + ascii_only: true, + } + input: { + var \u{2f800} = { + \u{2f801}: "\u{100000}", + }; + \u{2f800}.\u{2f802} = "\u{100001}"; + console.log(typeof \u{2f800}, \u{2f800}.\u{2f801}, \u{2f800}["\u{2f802}"]); + } + expect_exact: 'var \\u{2f800}={"\\ud87e\\udc01":"\\udbc0\\udc00"};\\u{2f800}.\\u{2f802}="\\udbc0\\udc01";console.log(typeof \\u{2f800},\\u{2f800}.\\u{2f801},\\u{2f800}["\\ud87e\\udc02"]);' + expect_stdout: "object \udbc0\udc00 \udbc0\udc01" + node_version: ">=4" +} |