From: Jackson Ray Hamilton Date: Sun, 24 Mar 2019 17:05:28 +0000 (-0700) Subject: Rename tests to use the “.jsx” file extension X-Git-Tag: emacs-27.0.90~3261^2~47 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d9d1bb2b07750f3b2f2a9f8fa3d7aa1a5ec5038e;p=emacs.git Rename tests to use the “.jsx” file extension * test/manual/indent/js-jsx-quote.js: Renamed to “jsx-quote.jsx”. * test/manual/indent/js-jsx-unclosed-1.js: Renamed to “jsx-unclosed-1.jsx”. * test/manual/indent/js-jsx-unclosed-2.js: Renamed to “jsx-unclosed-2.jsx”. * test/manual/indent/js-jsx.js: Renamed to “jsx.jsx”. * test/manual/indent/jsx-quote.jsx: Renamed from “js-jsx-quote.js”. * test/manual/indent/jsx-unclosed-1.jsx: Renamed from “js-jsx-unclosed-1.js”. * test/manual/indent/jsx-unclosed-2.jsx: Renamed from “js-jsx-unclosed-2.js”. * test/manual/indent/jsx.jsx: Renamed from “js-jsx.js”. --- diff --git a/test/manual/indent/js-jsx-quote.js b/test/manual/indent/js-jsx-quote.js deleted file mode 100644 index 4b71a656744..00000000000 --- a/test/manual/indent/js-jsx-quote.js +++ /dev/null @@ -1,18 +0,0 @@ -// -*- mode: js-jsx; -*- - -// JSX text node values should be strings, but only JS string syntax -// is considered, so quote marks delimit strings like normal, with -// disastrous results (https://github.com/mooz/js2-mode/issues/409). -function Bug() { - return
C'est Montréal
; -} -function Test(foo = /'/, - bar = 123) {} - -// This test is in a separate file because it can break other tests -// when indenting the whole buffer (not sure why). - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-level: 2 -// End: diff --git a/test/manual/indent/js-jsx-unclosed-1.js b/test/manual/indent/js-jsx-unclosed-1.js deleted file mode 100644 index 9418aed7a12..00000000000 --- a/test/manual/indent/js-jsx-unclosed-1.js +++ /dev/null @@ -1,15 +0,0 @@ -// -*- 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 deleted file mode 100644 index 843ef9b6a88..00000000000 --- a/test/manual/indent/js-jsx-unclosed-2.js +++ /dev/null @@ -1,39 +0,0 @@ -// -*- 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 - -// Allow unary keyword names as null-valued JSX attributes. -// (As if this will EVER happen…) - - - - - How would we ever live without unary support - - - - - -// “-” is not allowed in a JSXBoundaryElement’s name. - - // Weirdly-indented “continued expression.” - -// “-” may be used in a JSXAttribute’s name. - diff --git a/test/manual/indent/js-jsx.js b/test/manual/indent/js-jsx.js deleted file mode 100644 index 2ec00c63bbd..00000000000 --- a/test/manual/indent/js-jsx.js +++ /dev/null @@ -1,265 +0,0 @@ -// -*- mode: js-jsx; -*- - -var foo =
; - -return ( -
-
-
-
-
-
-
-
-); - -React.render( -
-
-
, - { - a: 1 - }, -
-
-
-); - -return ( - // Sneaky! -
-); - -return ( -
- // Sneaky! -); - -React.render( - , - { - a: 1 - } -); - -return ( -
- {array.map(function () { - return { - a: 1 - }; - })} -
-); - -return ( -
-
-); - -// Indent void expressions (no need for contextual parens / commas) -// (https://github.com/mooz/js2-mode/issues/140#issuecomment-166250016). -
-

Title

- {array.map(() => { - return ; - })} - {message} -
-// Another example of above issue -// (https://github.com/mooz/js2-mode/issues/490). - -
- {variable1} - -
-
- -// Comments and arrows can break indentation (Bug#24896 / -// https://github.com/mooz/js2-mode/issues/389). -const Component = props => ( - c} - b={123}> - -); -const Component = props => ( - - -); -const Component = props => ( // Parse this comment, please. - c} - b={123}> - -); -const Component = props => ( // Parse this comment, please. - - -); -// Another example of above issue (Bug#30225). -class { - render() { - return ( - - ); - } -} - -// JSX attributes of an arrow function’s expression body’s JSX -// expression should be indented with respect to the JSX opening -// element (Bug#26001 / -// https://github.com/mooz/js2-mode/issues/389#issuecomment-271869380). -class { - render() { - const messages = this.state.messages.map( - message => - ); return messages; - } - render() { - const messages = this.state.messages.map(message => - - ); return messages; - } -} - -// Users expect tag closers to align with the tag’s start; this is the -// style used in the React docs, so it should be the default. -// - https://github.com/mooz/js2-mode/issues/389#issuecomment-390766873 -// - https://github.com/mooz/js2-mode/issues/482 -// - Bug#32158 -const foo = (props) => ( -
- i} - /> - -
-); - -// Embedded JSX in parens breaks indentation -// (https://github.com/mooz/js2-mode/issues/411). -let a = ( -
- {condition && } - {condition && } -
-
-) -let b = ( -
- {condition && ()} -
-
-) -let c = ( -
- {condition && ()} - {condition && "something"} -
-) -let d = ( -
- {()} - {condition && "something"} -
-) -// Another example of the above issue (Bug#27000). -function testA() { - return ( -
-
{ (
) }
-
- ); -} -function testB() { - return ( -
-
{
}
-
- ); -} -// Another example of the above issue -// (https://github.com/mooz/js2-mode/issues/451). -class Classy extends React.Component { - render () { - return ( -
-
    - { this.state.list.map((item) => { - return (
    ) - })} -
-
- ) - } -} - -// Self-closing tags should be indented properly -// (https://github.com/mooz/js2-mode/issues/459). -export default ({ stars }) => ( -
-
- Congratulations! -
-
- 0)} size='large' /> -
- 1)} size='small' /> - 2)} size='small' /> -
-
-
- You have created 1 reminder -
-
-) - -// JS expressions should not break indentation -// (https://github.com/mooz/js2-mode/issues/462). -// -// In the referenced issue, the user actually wanted indentation which -// was simply different than Emacs’ SGML attribute indentation. -// Nevertheless, his issue highlighted our inability to properly -// indent code with JSX inside JSXExpressionContainers inside JSX. -return ( - - - ( -
nothing
- )} /> - -
-
-) - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-level: 2 -// End: diff --git a/test/manual/indent/jsx-quote.jsx b/test/manual/indent/jsx-quote.jsx new file mode 100644 index 00000000000..1b2c6528734 --- /dev/null +++ b/test/manual/indent/jsx-quote.jsx @@ -0,0 +1,16 @@ +// JSX text node values should be strings, but only JS string syntax +// is considered, so quote marks delimit strings like normal, with +// disastrous results (https://github.com/mooz/js2-mode/issues/409). +function Bug() { + return
C'est Montréal
; +} +function Test(foo = /'/, + bar = 123) {} + +// This test is in a separate file because it can break other tests +// when indenting the whole buffer (not sure why). + +// Local Variables: +// indent-tabs-mode: nil +// js-indent-level: 2 +// End: diff --git a/test/manual/indent/jsx-unclosed-1.jsx b/test/manual/indent/jsx-unclosed-1.jsx new file mode 100644 index 00000000000..1f5c3fba8da --- /dev/null +++ b/test/manual/indent/jsx-unclosed-1.jsx @@ -0,0 +1,13 @@ +// 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/jsx-unclosed-2.jsx b/test/manual/indent/jsx-unclosed-2.jsx new file mode 100644 index 00000000000..8db25aa67f1 --- /dev/null +++ b/test/manual/indent/jsx-unclosed-2.jsx @@ -0,0 +1,37 @@ +// 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 + +// Allow unary keyword names as null-valued JSX attributes. +// (As if this will EVER happen…) + + + + + How would we ever live without unary support + + + + + +// “-” is not allowed in a JSXBoundaryElement’s name. + + // Weirdly-indented “continued expression.” + +// “-” may be used in a JSXAttribute’s name. + diff --git a/test/manual/indent/jsx.jsx b/test/manual/indent/jsx.jsx new file mode 100644 index 00000000000..c2351a8cf1d --- /dev/null +++ b/test/manual/indent/jsx.jsx @@ -0,0 +1,263 @@ +var foo =
; + +return ( +
+
+
+
+
+
+
+
+); + +React.render( +
+
+
, + { + a: 1 + }, +
+
+
+); + +return ( + // Sneaky! +
+); + +return ( +
+ // Sneaky! +); + +React.render( + , + { + a: 1 + } +); + +return ( +
+ {array.map(function () { + return { + a: 1 + }; + })} +
+); + +return ( +
+
+); + +// Indent void expressions (no need for contextual parens / commas) +// (https://github.com/mooz/js2-mode/issues/140#issuecomment-166250016). +
+

Title

+ {array.map(() => { + return ; + })} + {message} +
+// Another example of above issue +// (https://github.com/mooz/js2-mode/issues/490). + +
+ {variable1} + +
+
+ +// Comments and arrows can break indentation (Bug#24896 / +// https://github.com/mooz/js2-mode/issues/389). +const Component = props => ( + c} + b={123}> + +); +const Component = props => ( + + +); +const Component = props => ( // Parse this comment, please. + c} + b={123}> + +); +const Component = props => ( // Parse this comment, please. + + +); +// Another example of above issue (Bug#30225). +class { + render() { + return ( + + ); + } +} + +// JSX attributes of an arrow function’s expression body’s JSX +// expression should be indented with respect to the JSX opening +// element (Bug#26001 / +// https://github.com/mooz/js2-mode/issues/389#issuecomment-271869380). +class { + render() { + const messages = this.state.messages.map( + message => + ); return messages; + } + render() { + const messages = this.state.messages.map(message => + + ); return messages; + } +} + +// Users expect tag closers to align with the tag’s start; this is the +// style used in the React docs, so it should be the default. +// - https://github.com/mooz/js2-mode/issues/389#issuecomment-390766873 +// - https://github.com/mooz/js2-mode/issues/482 +// - Bug#32158 +const foo = (props) => ( +
+ i} + /> + +
+); + +// Embedded JSX in parens breaks indentation +// (https://github.com/mooz/js2-mode/issues/411). +let a = ( +
+ {condition && } + {condition && } +
+
+) +let b = ( +
+ {condition && ()} +
+
+) +let c = ( +
+ {condition && ()} + {condition && "something"} +
+) +let d = ( +
+ {()} + {condition && "something"} +
+) +// Another example of the above issue (Bug#27000). +function testA() { + return ( +
+
{ (
) }
+
+ ); +} +function testB() { + return ( +
+
{
}
+
+ ); +} +// Another example of the above issue +// (https://github.com/mooz/js2-mode/issues/451). +class Classy extends React.Component { + render () { + return ( +
+
    + { this.state.list.map((item) => { + return (
    ) + })} +
+
+ ) + } +} + +// Self-closing tags should be indented properly +// (https://github.com/mooz/js2-mode/issues/459). +export default ({ stars }) => ( +
+
+ Congratulations! +
+
+ 0)} size='large' /> +
+ 1)} size='small' /> + 2)} size='small' /> +
+
+
+ You have created 1 reminder +
+
+) + +// JS expressions should not break indentation +// (https://github.com/mooz/js2-mode/issues/462). +// +// In the referenced issue, the user actually wanted indentation which +// was simply different than Emacs’ SGML attribute indentation. +// Nevertheless, his issue highlighted our inability to properly +// indent code with JSX inside JSXExpressionContainers inside JSX. +return ( + + + ( +
nothing
+ )} /> + +
+
+) + +// Local Variables: +// indent-tabs-mode: nil +// js-indent-level: 2 +// End: