diff options
author | Martin Probst <martin@probst.io> | 2016-09-02 14:29:48 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2016-09-02 14:29:48 +0000 |
commit | a9855afedfe65a797cf98b51171d6bee513e28b9 (patch) | |
tree | 5e998557921db23bc8b9d3ab079180344ab3181c /clang/unittests/Format | |
parent | 6918dcafe8ea256ae1ff0b51a95d4a5d076cd380 (diff) | |
download | bcm5719-llvm-a9855afedfe65a797cf98b51171d6bee513e28b9.tar.gz bcm5719-llvm-a9855afedfe65a797cf98b51171d6bee513e28b9.zip |
clang-format: [JS] merge requoting replacements.
Summary:
When formatting source code that needs both requoting and reindentation,
merge the replacements to avoid erroring out for conflicting replacements.
Also removes the misleading Replacements parameter from the
TokenAnalyzer API.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D24155
llvm-svn: 280487
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 60063934cd9..ed227852ef4 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1334,6 +1334,13 @@ TEST_F(FormatTestJS, RequoteStringsSingle) { "let x = \"single\";\n"); } +TEST_F(FormatTestJS, RequoteAndIndent) { + verifyFormat("let x = someVeryLongFunctionThatGoesOnAndOn(\n" + " 'double quoted string that needs wrapping');", + "let x = someVeryLongFunctionThatGoesOnAndOn(" + "\"double quoted string that needs wrapping\");"); +} + TEST_F(FormatTestJS, RequoteStringsDouble) { FormatStyle DoubleQuotes = getGoogleStyle(FormatStyle::LK_JavaScript); DoubleQuotes.JavaScriptQuotes = FormatStyle::JSQS_Double; |