summaryrefslogtreecommitdiffstats
path: root/unittests
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
commit703ec475b843fd296ecf1287fdf9a580c64e4103 (patch)
tree87523e9e8e350c631f746cc11e02fe1d29446e9a /unittests
parent77012dd049598b3d73663a15ebf1e95c5f27bad5 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTestJS.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp
index 822d572b94..c39667613c 100644
--- a/unittests/Format/FormatTestJS.cpp
+++ b/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}");