diff options
author | Daniel Jasper <djasper@google.com> | 2015-07-02 13:08:28 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-07-02 13:08:28 +0000 |
commit | 553a5b00412c34e2b9101a993a6e7368a03fca68 (patch) | |
tree | 86edf9300a08dad4477f5a1ffed6c5072e129360 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 9b869aa4a10c5392cb4d68f32a0acf8f635a7164 (diff) | |
download | bcm5719-llvm-553a5b00412c34e2b9101a993a6e7368a03fca68.tar.gz bcm5719-llvm-553a5b00412c34e2b9101a993a6e7368a03fca68.zip |
clang-format: [JS] Fix character counting in template strings.
Some counts were off, we don't need to take the leading newlines of the
first ` into account and some tests were just wrong.
llvm-svn: 241257
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 63bcfdc1744..845ae5124b2 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -795,15 +795,11 @@ TEST_F(FormatTestJS, TemplateStrings) { " ${ name }\n" " !`;")); - // FIXME: +1 / -1 offsets are to work around clang-format miscalculating - // widths for unknown tokens that are not whitespace (e.g. '`'). Remove when - // the code is corrected. - verifyFormat("var x =\n" " `hello ${world}` >= some();", getGoogleJSStyleWithColumns(34)); // Barely doesn't fit. verifyFormat("var x = `hello ${world}` >= some();", - getGoogleJSStyleWithColumns(35 + 1)); // Barely fits. + getGoogleJSStyleWithColumns(35)); // Barely fits. EXPECT_EQ("var x = `hello\n" " ${world}` >=\n" " some();", @@ -818,10 +814,14 @@ TEST_F(FormatTestJS, TemplateStrings) { " ${world}` >= some();", getGoogleJSStyleWithColumns(22))); // Barely fits. - verifyFormat("var x =\n `h`;", getGoogleJSStyleWithColumns(13 - 1)); + verifyFormat("var x =\n" + " `h`;", + getGoogleJSStyleWithColumns(11)); EXPECT_EQ( "var x =\n `multi\n line`;", - format("var x = `multi\n line`;", getGoogleJSStyleWithColumns(14 - 1))); + format("var x = `multi\n line`;", getGoogleJSStyleWithColumns(13))); + verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" + " `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`);"); // Make sure template strings get a proper ColumnWidth assigned, even if they // are first token in line. |