From 54b8b1cb4ab0d4041b4e0613af0bc71e594aecbc Mon Sep 17 00:00:00 2001 From: Jackson Ray Hamilton Date: Sun, 10 Feb 2019 21:11:17 -0800 Subject: [PATCH] Add new (failing) unclosed JSX test and separate such tests * 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 | 15 +++++++++++++++ test/manual/indent/js-jsx-unclosed-2.js | 17 +++++++++++++++++ test/manual/indent/js-jsx.js | 9 --------- 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 test/manual/indent/js-jsx-unclosed-1.js create mode 100644 test/manual/indent/js-jsx-unclosed-2.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 index 0000000000..9418aed7a1 --- /dev/null +++ b/test/manual/indent/js-jsx-unclosed-1.js @@ -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 ( +
+ {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 index 0000000000..2d42cf70f8 --- /dev/null +++ b/test/manual/indent/js-jsx-unclosed-2.js @@ -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 diff --git a/test/manual/indent/js-jsx.js b/test/manual/indent/js-jsx.js index 35ca4b275a..af3c340559 100644 --- a/test/manual/indent/js-jsx.js +++ b/test/manual/indent/js-jsx.js @@ -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 ( -
- {array.map(function () { - return { - a: 1 -- 2.11.0