From e1f72a6727f39f730601f7cb3537ac4f9065609b Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Sat, 9 Jan 2016 21:12:45 +0000 Subject: 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 --- clang/unittests/Format/FormatTestJS.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') 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" " ;", -- cgit v1.2.3