]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new (failing) unclosed JSX test and separate such tests
authorJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Mon, 11 Feb 2019 05:11:17 +0000 (21:11 -0800)
committerJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Tue, 9 Apr 2019 05:48:20 +0000 (22:48 -0700)
* test/manual/indent/js-jsx.js: Move test with intentional scan error to
its own file, js-jsx-unclosed-1.js.
* test/manual/indent/js-jsx-unclosed-1.js: New file.
* test/manual/indent/js-jsx-unclosed-2.js: New file with test for
regression caused by new ambiguous parsing of JS/JSX.

test/manual/indent/js-jsx-unclosed-1.js [new file with mode: 0644]
test/manual/indent/js-jsx-unclosed-2.js [new file with mode: 0644]
test/manual/indent/js-jsx.js

diff --git a/test/manual/indent/js-jsx-unclosed-1.js b/test/manual/indent/js-jsx-unclosed-1.js
new file mode 100644 (file)
index 0000000..9418aed
--- /dev/null
@@ -0,0 +1,15 @@
+// -*- mode: js-jsx; -*-
+
+// Local Variables:
+// indent-tabs-mode: nil
+// js-indent-level: 2
+// End:
+
+// The following test goes below any comments to avoid including
+// misindented comments among the erroring lines.
+
+return (
+  <div>
+    {array.map(function () {
+      return {
+        a: 1
diff --git a/test/manual/indent/js-jsx-unclosed-2.js b/test/manual/indent/js-jsx-unclosed-2.js
new file mode 100644 (file)
index 0000000..2d42cf7
--- /dev/null
@@ -0,0 +1,17 @@
+// -*- mode: js-jsx; -*-
+
+// Local Variables:
+// indent-tabs-mode: nil
+// js-indent-level: 2
+// End:
+
+// The following tests go below any comments to avoid including
+// misindented comments among the erroring lines.
+
+// Don’t misinterpret equality operators as JSX.
+for (; i < length;) void 0
+if (foo > bar) void 0
+
+// Don’t even misinterpret unary operators as JSX.
+if (foo < await bar) void 0
+while (await foo > bar) void 0
index 35ca4b275a67cda979a1185ee29afea5db95a012..af3c34055900a120b37a49c47380cf774adc4e7e 100644 (file)
@@ -257,12 +257,3 @@ return (
 // indent-tabs-mode: nil
 // js-indent-level: 2
 // End:
-
-// The following test has intentionally unclosed elements and should
-// be placed below all other tests to prevent awkward indentation.
-
-return (
-  <div>
-    {array.map(function () {
-      return {
-        a: 1