diff options
| author | Daniel Jasper <djasper@google.com> | 2017-01-31 13:03:07 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2017-01-31 13:03:07 +0000 |
| commit | 24de6fbfdb72a1c06492a922f68b03ed3035c63b (patch) | |
| tree | 4ed1444f850b814d3cba105bd0585f93ed1a0bdc /clang/unittests/Format/FormatTestJS.cpp | |
| parent | dbaacc75664e9322643b5a43cde6fc5e5e39e1b1 (diff) | |
| download | bcm5719-llvm-24de6fbfdb72a1c06492a922f68b03ed3035c63b.tar.gz bcm5719-llvm-24de6fbfdb72a1c06492a922f68b03ed3035c63b.zip | |
clang-format: [JS] Properly set scopes inside template strings.
Before:
var f = `aaaaaaaaaaaaa:${aaaaaaa
.aaaaa} aaaaaaaa
aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;
After:
var f = `aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa
aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;
llvm-svn: 293622
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
| -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 71821a06499..6cc3bcd16c4 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1392,6 +1392,13 @@ TEST_F(FormatTestJS, TemplateStrings) { // The token stream can contain two string_literals in sequence, but that // doesn't mean that they are implicitly concatenated in JavaScript. verifyFormat("var f = `aaaa ${a ? 'a' : 'b'}`;"); + + // Ensure that scopes are appropriately set around evaluated expressions in + // template strings. + verifyFormat("var f = `aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa\n" + " aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;", + "var f = `aaaaaaaaaaaaa:${aaaaaaa. aaaaa} aaaaaaaa\n" + " aaaaaaaaaaaaa:${ aaaaaaa. aaaaa} aaaaaaaa`;"); } TEST_F(FormatTestJS, TemplateStringASI) { |

