From 25c29908626548cee8a40bd153bde2b4f98490d3 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Thu, 22 May 2014 09:10:04 +0000 Subject: clang-format: [JS] Understand line breaks in concatenated strings. Before: var literal = 'hello ' + 'world'; After: var literal = 'hello ' + 'world'; There is no reason to concatenated two string literals with a '+' unless the line break is intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209413 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Format/FormatTestJS.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'unittests/Format') diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index 33bfe06e5f..ecf4e69999 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -164,6 +164,11 @@ TEST_F(FormatTestJS, TryCatch) { "}"); } +TEST_F(FormatTestJS, StringLiteralConcatenation) { + verifyFormat("var literal = 'hello ' +\n" + " 'world';"); +} + TEST_F(FormatTestJS, RegexLiteralClassification) { // Regex literals. verifyFormat("var regex = /abc/;"); -- cgit v1.2.3