aboutsummaryrefslogtreecommitdiff
path: root/test/compress/regexp.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/regexp.js')
-rw-r--r--test/compress/regexp.js37
1 files changed, 37 insertions, 0 deletions
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"]'
+}