From: Martin Probst Date: Tue, 19 Apr 2016 14:59:16 +0000 (+0000) Subject: Summary: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0129437f6a5b44a3c5514cf6ae3d52cf1236732f;p=clang Summary: clang-format: [JS] unit tests for type aliases. Also adds a test for "foo as bar" casts. Spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#3.10 These are already handled correctly. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19206 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266744 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index a3cb6016d6..aa79fa3024 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -943,6 +943,16 @@ TEST_F(FormatTestJS, MetadataAnnotations) { "class Y {}"); } +TEST_F(FormatTestJS, TypeAliases) { + verifyFormat("type X = number;\n" + "class C {}"); + verifyFormat("type X = Z;"); + 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';"); @@ -1095,7 +1105,10 @@ TEST_F(FormatTestJS, TemplateStrings) { "var y;"); } -TEST_F(FormatTestJS, CastSyntax) { verifyFormat("var x = foo;"); } +TEST_F(FormatTestJS, CastSyntax) { + verifyFormat("var x = foo;"); + verifyFormat("var x = foo as type;"); +} TEST_F(FormatTestJS, TypeArguments) { verifyFormat("class X {}");