diff options
author | Daniel Jasper <djasper@google.com> | 2015-06-14 07:16:57 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-06-14 07:16:57 +0000 |
commit | 2ebb0c57fbfcebba9de721e65bea0886b8033f36 (patch) | |
tree | 93667ae2f0a20b028af887d9472e35e8479c1c21 /clang/unittests/Format/FormatTestJS.cpp | |
parent | a6a250a21145e852fafd5ab316732134ca08eb2c (diff) | |
download | bcm5719-llvm-2ebb0c57fbfcebba9de721e65bea0886b8033f36.tar.gz bcm5719-llvm-2ebb0c57fbfcebba9de721e65bea0886b8033f36.zip |
clang-format: [JS] Fix corner case in template string parsing.
Before, these would not properly detected because of the char/string
literal found when re-lexing after the first `:
var x = `'`; // comment with matching quote '
var x = `"`; // comment with matching quote "
llvm-svn: 239693
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 31386b448ac..5b01832ef45 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -809,6 +809,11 @@ TEST_F(FormatTestJS, TemplateStrings) { "var y;", format("var x =\n `/*a`;\n" "var y;")); + // Unterminated string literals in a template string. + verifyFormat("var x = `'`; // comment with matching quote '\n" + "var y;"); + verifyFormat("var x = `\"`; // comment with matching quote \"\n" + "var y;"); // Backticks in a comment - not a template string. EXPECT_EQ("var x = 1 // `/*a`;\n" " ;", |