clang-format: [JS] support cast syntax and type arguments.
Casts in TS syntax (foo = <type>bar;) should not be followed by
whitespace.
Patch by Martin Probst. Thank you.
llvm-svn: 232321
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 045b280..5707024 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -616,5 +616,17 @@
verifyFormat("var x = `hello` == `hello`;");
}
+TEST_F(FormatTestJS, CastSyntax) {
+ verifyFormat("var x = <type>foo;");
+}
+
+TEST_F(FormatTestJS, TypeArguments) {
+ verifyFormat("class X<Y> {}");
+ verifyFormat("new X<Y>();");
+ verifyFormat("foo<Y>(a);");
+ verifyFormat("var x: X<Y>[];");
+ verifyFormat("class C extends D<E> implements F<G>, H<I> {}");
+}
+
} // end namespace tooling
} // end namespace clang