summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2019-03-19 11:15:52 +0000
committerMartin Probst <martin@probst.io>2019-03-19 11:15:52 +0000
commitb274d3d79930034b8c3b2e0fc2372b66ef171eb1 (patch)
treee2a5e8fcd5d5bed61d7b75970445cdda2bf1e108 /clang/unittests/Format
parent52b49ab3fd92339cec96156396f6b7a6d48e17b2 (diff)
downloadbcm5719-llvm-b274d3d79930034b8c3b2e0fc2372b66ef171eb1.tar.gz
bcm5719-llvm-b274d3d79930034b8c3b2e0fc2372b66ef171eb1.zip
[clang-format] [JS] Don't break between template string and tag
Before: const x = veryLongIdentifier `hello`; After: const x = veryLongIdentifier`hello`; While it's allowed to have the template string and tag identifier separated by a line break, currently the clang-format output is not stable when a break is forced. Additionally, disallowing a line break makes it clear that the identifier is actually a tag for a template string. Patch originally by mitchellwills (thanks!). llvm-svn: 356447
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index ed8faabb3f2..528e4cf57cb 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -1962,6 +1962,12 @@ TEST_F(FormatTestJS, NestedTemplateStrings) {
TEST_F(FormatTestJS, TaggedTemplateStrings) {
verifyFormat("var x = html`<ul>`;");
verifyFormat("yield `hello`;");
+ verifyFormat("var f = {\n"
+ " param: longTagName`This is a ${\n"
+ " 'really'} long line`\n"
+ "};",
+ "var f = {param: longTagName`This is a ${'really'} long line`};",
+ getGoogleJSStyleWithColumns(40));
}
TEST_F(FormatTestJS, CastSyntax) {
OpenPOWER on IntegriCloud