diff options
author | Martin Probst <martin@probst.io> | 2016-04-19 14:59:16 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2016-04-19 14:59:16 +0000 |
commit | 805c6167c2c98bcb7b216a2b6628071fa551e413 (patch) | |
tree | a484593d6efea3c728cbeb7bd3563e394c713aad | |
parent | 053f1aa6d09df250ef27b992974b06bbad637557 (diff) | |
download | bcm5719-llvm-805c6167c2c98bcb7b216a2b6628071fa551e413.tar.gz bcm5719-llvm-805c6167c2c98bcb7b216a2b6628071fa551e413.zip |
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
llvm-svn: 266744
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index a3cb6016d64..aa79fa30245 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/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<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';"); @@ -1095,7 +1105,10 @@ TEST_F(FormatTestJS, TemplateStrings) { "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> {}"); |