diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-02-15 05:26:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-15 05:26:48 +0000 |
commit | 0d820e4c0a7a1b1eeee25fb632b9496a9780b28a (patch) | |
tree | 53cfd159f60fde0f523e48b982fd4f64c7daaa4c /test | |
parent | f01f580d6c2312ba556a37144f6fef227bd89f77 (diff) | |
download | tracifyjs-0d820e4c0a7a1b1eeee25fb632b9496a9780b28a.tar.gz tracifyjs-0d820e4c0a7a1b1eeee25fb632b9496a9780b28a.zip |
workaround RegExp formatting bugs (#3720)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/regexp.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/compress/regexp.js b/test/compress/regexp.js index 460ff504..defc0079 100644 --- a/test/compress/regexp.js +++ b/test/compress/regexp.js @@ -186,3 +186,72 @@ issue_3434_3: { /\nfo\n[\n]o\bbb/; } } + +issue_3434_4: { + options = { + evaluate: true, + unsafe: true, + } + input: { + [ + [ "", RegExp("") ], + [ "/", RegExp("/") ], + [ "//", RegExp("//") ], + [ "\/", RegExp("\\/") ], + [ "///", RegExp("///") ], + [ "/\/", RegExp("/\\/") ], + [ "\//", RegExp("\\//") ], + [ "\\/", RegExp("\\\\/") ], + [ "////", RegExp("////") ], + [ "//\/", RegExp("//\\/") ], + [ "/\//", RegExp("/\\//") ], + [ "/\\/", RegExp("/\\\\/") ], + [ "\///", RegExp("\\///") ], + [ "\/\/", RegExp("\\/\\/") ], + [ "\\//", RegExp("\\\\//") ], + [ "\\\/", RegExp("\\\\\\/") ], + ].forEach(function(test) { + console.log(test[1].test("\\"), test[1].test(test[0])); + }); + } + expect: { + [ + [ "", /(?:)/ ], + [ "/", /\// ], + [ "//", /\/\// ], + [ "/", /\// ], + [ "///", /\/\/\// ], + [ "//", /\/\// ], + [ "//", /\/\// ], + [ "\\/", /\\\// ], + [ "////", /\/\/\/\// ], + [ "///", /\/\/\// ], + [ "///", /\/\/\// ], + [ "/\\/", /\/\\\// ], + [ "///", /\/\/\// ], + [ "//", /\/\// ], + [ "\\//", /\\\/\// ], + [ "\\/", /\\\// ], + ].forEach(function(test) { + console.log(test[1].test("\\"), test[1].test(test[0])); + }); + } + expect_stdout: [ + "true true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + "false true", + ] +} |