mprobst created this revision. mprobst added a reviewer: djasper. mprobst added a subscriber: cfe-commits. Herald added a subscriber: klimek.
clang-format: [JS] unit tests for type aliases. Spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#3.10 These are already handled correctly. 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,15 @@ "class Y {}"); } +TEST_F(FormatTestJS, TypeDefinitions) { + verifyFormat("type X = number;\n" + "class C {}"); + 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 +1100,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> {}");
Index: unittests/Format/FormatTestJS.cpp =================================================================== --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -943,6 +943,15 @@ "class Y {}"); } +TEST_F(FormatTestJS, TypeDefinitions) { + verifyFormat("type X = number;\n" + "class C {}"); + 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 +1100,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> {}");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits