aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2024-12-17 09:05:01 -0700
committerGitHub <noreply@github.com>2024-12-17 08:05:01 -0800
commit57c161a6479fb70a31553e2f9bc1efa46262aa92 (patch)
treec73698681f49c13a9662de6871112fe6cb142a22 /clang/unittests/Format/FormatTestJS.cpp
parent146240ef1c0f25259ef30d9d14c124e574764a01 (diff)
downloadllvm-57c161a6479fb70a31553e2f9bc1efa46262aa92.zip
llvm-57c161a6479fb70a31553e2f9bc1efa46262aa92.tar.gz
llvm-57c161a6479fb70a31553e2f9bc1efa46262aa92.tar.bz2
[clang-format] Detect nesting in template strings (#119989)
The helper to check if a token is in a template string scans too far backward. It should stop if a different scope is found. Fixes #107571
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 663b00c..78c9f88 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -2161,6 +2161,13 @@ TEST_F(FormatTestJS, TemplateStringMultiLineExpression) {
" aaaa: aaaaa,\n"
" bbbb: bbbbb,\n"
" })}`;");
+
+ verifyFormat("`${\n"
+ " (\n"
+ " FOOFOOFOOFOO____FOO_FOO_FO_FOO_FOOO -\n"
+ " (barbarbarbar____bar_bar_bar_bar_bar_bar +\n"
+ " bar_bar_bar_barbarbar___bar_bar_bar + 1),\n"
+ " )}`;");
}
TEST_F(FormatTestJS, TemplateStringASI) {