summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-03-21 17:57:31 +0000
committerDaniel Jasper <djasper@google.com>2016-03-21 17:57:31 +0000
commit91b1d1ab6c1c027fc5f9bc5e22184d2e572b4026 (patch)
tree4174d8c9f1acafe72d71a449571b54347227ea17 /clang/unittests/Format/FormatTestJS.cpp
parent75bc676160c00f73cfdf0b5577b4e57196861bf9 (diff)
downloadbcm5719-llvm-91b1d1ab6c1c027fc5f9bc5e22184d2e572b4026.tar.gz
bcm5719-llvm-91b1d1ab6c1c027fc5f9bc5e22184d2e572b4026.zip
clang-format: [JS] no space in union and intersection types.
The operators | and & in types, as opposed to the bitwise operators, should not have whitespace around them (e.g. `Foo<Bar|Baz>`). Patch by Martin Probst. Thank you. llvm-svn: 263961
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 822d572b944..c39667613c0 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -847,6 +847,14 @@ TEST_F(FormatTestJS, TypeAnnotations) {
getGoogleJSStyleWithColumns(60));
}
+TEST_F(FormatTestJS, UnionIntersectionTypes) {
+ verifyFormat("let x: A|B = A | B;");
+ verifyFormat("let x: A&B|C = A & B;");
+ verifyFormat("let x: Foo<A|B> = new Foo<A|B>();");
+ verifyFormat("function(x: A|B): C&D {}");
+ verifyFormat("function(x: A|B = A | B): C&D {}");
+}
+
TEST_F(FormatTestJS, ClassDeclarations) {
verifyFormat("class C {\n x: string = 12;\n}");
verifyFormat("class C {\n x(): string => 12;\n}");
OpenPOWER on IntegriCloud