[PATCH] D19206: Add a test for "foo as bar" casts.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 17 18:05:58 PDT 2016


mprobst updated this revision to Diff 54019.
mprobst added a comment.

- test, test name


http://reviews.llvm.org/D19206

Files:
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===================================================================
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -943,6 +943,16 @@
                "class Y {}");
 }
 
+TEST_F(FormatTestJS, TypeAliases) {
+  verifyFormat("type X = number;\n"
+               "class C {}");
+  verifyFormat("type X<Y> = Z<Y>;");
+  verifyFormat("type X = {\n"
+               "  y: number\n"
+               "};\n"
+               "class C {}");
+}
+
 TEST_F(FormatTestJS, Modules) {
   verifyFormat("import SomeThing from 'some/module.js';");
   verifyFormat("import {X, Y} from 'some/module.js';");
@@ -1091,7 +1101,10 @@
                "var y;");
 }
 
-TEST_F(FormatTestJS, CastSyntax) { verifyFormat("var x = <type>foo;"); }
+TEST_F(FormatTestJS, CastSyntax) {
+  verifyFormat("var x = <type>foo;");
+  verifyFormat("var x = foo as type;");
+}
 
 TEST_F(FormatTestJS, TypeArguments) {
   verifyFormat("class X<Y> {}");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19206.54019.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160418/956dab00/attachment.bin>


More information about the cfe-commits mailing list