diff options
| author | Martin Probst <martin@probst.io> | 2016-10-21 05:11:38 +0000 |
|---|---|---|
| committer | Martin Probst <martin@probst.io> | 2016-10-21 05:11:38 +0000 |
| commit | 717f6dcddcff34b4c67fa4343689b234cdbc7c04 (patch) | |
| tree | af4f1599ae58b3de61d7fc8e1f2f210a50d40845 /clang/unittests/Format/FormatTestJS.cpp | |
| parent | 34b411f07779dc4c95b9f8f815c73b3b39b9eff9 (diff) | |
| download | bcm5719-llvm-717f6dcddcff34b4c67fa4343689b234cdbc7c04.tar.gz bcm5719-llvm-717f6dcddcff34b4c67fa4343689b234cdbc7c04.zip | |
clang-format: [JS] Fix template string ASI.
Summary:
Previously, automatic semicolon insertion would add an unwrapped line
when a template string contained a line break.
var x = `foo${
bar}`;
Would be formatted with `bar...` on a separate line and no indent.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D25675
llvm-svn: 284807
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 329613813c0..66d72534e24 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1276,6 +1276,12 @@ TEST_F(FormatTestJS, TemplateStrings) { verifyFormat("var x = ` \\${foo}`;\n"); } +TEST_F(FormatTestJS, TemplateStringASI) { + verifyFormat("var x = `hello${world}`;", "var x = `hello${\n" + " world\n" + "}`;"); +} + TEST_F(FormatTestJS, NestedTemplateStrings) { verifyFormat( "var x = `<ul>${xs.map(x => `<li>${x}</li>`).join('\\n')}</ul>`;"); |

