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
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 3296138..66d7253 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -1276,6 +1276,12 @@
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>`;");