diff options
author | Daniel Jasper <djasper@google.com> | 2015-12-30 08:00:58 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-12-30 08:00:58 +0000 |
commit | 779c66f3ca9e51efd0b8eaac75347df4b109c7d2 (patch) | |
tree | 218bb1d451e9091ed9f7c4250dee8a0db6bd2355 /clang/unittests/Format/FormatTestJS.cpp | |
parent | f98eb3548cafbeb780a251f17682fa0572c6dc6d (diff) | |
download | bcm5719-llvm-779c66f3ca9e51efd0b8eaac75347df4b109c7d2.tar.gz bcm5719-llvm-779c66f3ca9e51efd0b8eaac75347df4b109c7d2.zip |
clang-format: [JS] Support TypeScript 1.6 user defined type guards.
Before:
function foo(check: Object): check
is{foo: string, bar: string, baz: string, foobar: string} {
return 'bar' in check;
}
After:
function foo(check: Object):
check is {foo: string, bar: string, baz: string, foobar: string} {
return 'bar' in check;
}
llvm-svn: 256631
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 56b493dae1c..cba2ce3370c 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -962,6 +962,14 @@ TEST_F(FormatTestJS, TypeArguments) { " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {}"); } +TEST_F(FormatTestJS, UserDefinedTypeGuards) { + verifyFormat( + "function foo(check: Object):\n" + " check is {foo: string, bar: string, baz: string, foobar: string} {\n" + " return 'bar' in check;\n" + "}\n"); +} + TEST_F(FormatTestJS, OptionalTypes) { verifyFormat("function x(a?: b, c?, d?) {}"); verifyFormat("class X {\n" |