summaryrefslogtreecommitdiff
path: root/unittests/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-05-22 09:10:04 +0000
committerDaniel Jasper <djasper@google.com>2014-05-22 09:10:04 +0000
commit25c29908626548cee8a40bd153bde2b4f98490d3 (patch)
tree794b119e0288f5478b2bfd794f01f3c4cb4fc186 /unittests/Format
parent643549ba9307e74cae7b5a5bf1711e469f3b190e (diff)
downloadclang-25c29908626548cee8a40bd153bde2b4f98490d3.tar.gz
clang-25c29908626548cee8a40bd153bde2b4f98490d3.tar.bz2
clang-25c29908626548cee8a40bd153bde2b4f98490d3.tar.xz
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
Diffstat (limited to 'unittests/Format')
-rw-r--r--unittests/Format/FormatTestJS.cpp5
1 files changed, 5 insertions, 0 deletions
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/;");