From 8c62d854ce90210d278707c9aff58f10c26e3c27 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 23 May 2018 17:24:13 +0800 Subject: augment tests for `RegExp` (#3144) --- test/compress/regexp.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/compress/regexp.js (limited to 'test/compress/regexp.js') diff --git a/test/compress/regexp.js b/test/compress/regexp.js new file mode 100644 index 00000000..ac834e5d --- /dev/null +++ b/test/compress/regexp.js @@ -0,0 +1,37 @@ +regexp_simple: { + input: { + /rx/ig + } + expect_exact: "/rx/gi;" +} + +regexp_slashes: { + input: { + /\\\/rx\/\\/ig + } + expect_exact: "/\\\\\\/rx\\/\\\\/gi;" +} + +regexp_1: { + input: { + console.log(JSON.stringify("COMPASS? Overpass.".match(/([Sap]+)/ig))); + } + expect: { + console.log(JSON.stringify("COMPASS? Overpass.".match(/([Sap]+)/gi))); + } + expect_stdout: '["PASS","pass"]' +} + +regexp_2: { + options = { + evaluate: true, + unsafe: true, + } + input: { + console.log(JSON.stringify("COMPASS? Overpass.".match(new RegExp("([Sap]+)", "ig")))); + } + expect: { + console.log(JSON.stringify("COMPASS? Overpass.".match(/([Sap]+)/gi))); + } + expect_stdout: '["PASS","pass"]' +} -- cgit v1.2.3