diff options
author | Daniel Jasper <djasper@google.com> | 2016-01-09 21:12:45 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-01-09 21:12:45 +0000 |
commit | e1f72a6727f39f730601f7cb3537ac4f9065609b (patch) | |
tree | 07bf67dd18e55b48cedaed34b787d9cba0814e65 /clang/unittests/Format/FormatTestJS.cpp | |
parent | c7bebcbfd871b9253603473b60bf585e0cabefaa (diff) | |
download | bcm5719-llvm-e1f72a6727f39f730601f7cb3537ac4f9065609b.tar.gz bcm5719-llvm-e1f72a6727f39f730601f7cb3537ac4f9065609b.zip |
clang-format: Fix the counting of leading whitespace in tok::unknown tokens
Previously, all whitespace characters would increase the starting
column, which doesn't make sense. This fixes a problem, e.g. with the
length calculation in JS template strings.
llvm-svn: 257267
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index a35a86ea4ed..4e974d7285d 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -956,6 +956,9 @@ TEST_F(FormatTestJS, TemplateStrings) { "var y;"); verifyFormat("var x = `\"`; // comment with matching quote \"\n" "var y;"); + EXPECT_EQ("it(`'aaaaaaaaaaaaaaa `, aaaaaaaaa);", + format("it(`'aaaaaaaaaaaaaaa `, aaaaaaaaa) ;", + getGoogleJSStyleWithColumns(40))); // Backticks in a comment - not a template string. EXPECT_EQ("var x = 1 // `/*a`;\n" " ;", |