clang-format: [JS] recognize more type locations.
Summary: Includes parenthesized type expressions and type aliases.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D21597
llvm-svn: 273603
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 4feb55d..bd5a505 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -914,6 +914,12 @@
verifyFormat("function(x: A|B = A | B): C&D {}");
verifyFormat("function x(path: number|string) {}");
verifyFormat("function x(): string|number {}");
+ verifyFormat("type Foo = Bar|Baz;");
+ verifyFormat("type Foo = Bar<X>|Baz;");
+ verifyFormat("type Foo = (Bar<X>|Baz);");
+ verifyFormat("let x: Bar|Baz;");
+ verifyFormat("let x: Bar<X>|Baz;");
+ verifyFormat("let x: (Foo|Bar)[];");
}
TEST_F(FormatTestJS, ClassDeclarations) {