From 717f6dcddcff34b4c67fa4343689b234cdbc7c04 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Fri, 21 Oct 2016 05:11:38 +0000 Subject: 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 --- clang/unittests/Format/FormatTestJS.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') 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 = ``;"); -- cgit v1.2.3