aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'integration/snippets')
-rw-r--r--integration/snippets/lodash-regexp.js24
-rw-r--r--integration/snippets/package.json1
-rw-r--r--integration/snippets/public/index.html17
3 files changed, 42 insertions, 0 deletions
diff --git a/integration/snippets/lodash-regexp.js b/integration/snippets/lodash-regexp.js
new file mode 100644
index 000000000..bc683e535
--- /dev/null
+++ b/integration/snippets/lodash-regexp.js
@@ -0,0 +1,24 @@
+import { shuffle } from "lodash";
+
+// Lodash uses a variety of uncommon syntax (such as unicode escapes in regexp)
+// so running it is a broad test of the parser, lexer, and printer
+export function test() {
+ const foo = [1, 2, 3, 4, 6];
+ const bar = shuffle(foo);
+ console.assert(bar !== foo);
+ console.assert(bar.length === foo.length);
+ bar.sort();
+ foo.sort();
+ for (let i = 0; i < bar.length; i++) {
+ console.assert(bar[i] === foo[i], "expected " + i + " to be " + foo[i]);
+ console.assert(typeof bar[i] === "number");
+ console.assert(typeof foo[i] === "number");
+ }
+
+ return testDone(import.meta.url);
+}
+
+// export function test() {
+// const regexp = RegExp("['\u2019]", "g");
+// return testDone(import.meta.url);
+// }
diff --git a/integration/snippets/package.json b/integration/snippets/package.json
index 8edbd79a1..1c0cb8b7b 100644
--- a/integration/snippets/package.json
+++ b/integration/snippets/package.json
@@ -4,6 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
+ "lodash": "^4.17.21",
"react": "^17.0.2",
"redux": "^4.1.1"
}
diff --git a/integration/snippets/public/index.html b/integration/snippets/public/index.html
index 74a744a7d..5358fa423 100644
--- a/integration/snippets/public/index.html
+++ b/integration/snippets/public/index.html
@@ -46,6 +46,23 @@
return await testFunction();
};
+
+ if (globalThis.location.pathname.endsWith("-test")) {
+ globalThis.testDone = (path) => alert(`test ${path} success`);
+ globalThis.testFail = (path) => alert(`!test ${path} fail`);
+ runTest(
+ globalThis.location.pathname.substring(
+ 0,
+ location.pathname.length - "-test".length
+ )
+ ).then(
+ () => {},
+ (err) => {
+ console.error(err);
+ alert(err.toString());
+ }
+ );
+ }
</script>
</body>
</html>