diff options
author | Daniel Jasper <djasper@google.com> | 2016-01-09 15:56:28 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-01-09 15:56:28 +0000 |
commit | b9a4990a9ce18e567e13a23732425143e5cfee3e (patch) | |
tree | acc7926974e410ae69032e484307c6d3eeff3823 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 9c14e282112c0ae8aa4e713494058e6e49335e2e (diff) | |
download | bcm5719-llvm-b9a4990a9ce18e567e13a23732425143e5cfee3e.tar.gz bcm5719-llvm-b9a4990a9ce18e567e13a23732425143e5cfee3e.zip |
clang-format: [JS] Support semicolons in TypeScript's TypeMemberLists.
Before:
var x: {
a: string;
b: number;
}
= {};
After:
var x: {a: string; b: number;} = {};
llvm-svn: 257255
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 7514c43ad43..a35a86ea4ed 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -731,10 +731,14 @@ TEST_F(FormatTestJS, RegexLiteralExamples) { TEST_F(FormatTestJS, TypeAnnotations) { verifyFormat("var x: string;"); + verifyFormat("var x: {a: string; b: number;} = {};"); verifyFormat("function x(): string {\n return 'x';\n}"); verifyFormat("function x(): {x: string} {\n return {x: 'x'};\n}"); verifyFormat("function x(y: string): string {\n return 'x';\n}"); verifyFormat("for (var y: string in x) {\n x();\n}"); + verifyFormat("function x(y: {a?: number;} = {}): number {\n" + " return 12;\n" + "}"); verifyFormat("((a: string, b: number): string => a + b);"); verifyFormat("var x: (y: number) => string;"); verifyFormat("var x: P<string, (a: number) => string>;"); @@ -764,6 +768,10 @@ TEST_F(FormatTestJS, ClassDeclarations) { verifyFormat("foo = class {\n" " constructor() {}\n" "};"); + verifyFormat("class C {\n" + " x: {y: Z;} = {};\n" + " private y: {y: Z;} = {};\n" + "}"); // ':' is not a type declaration here. verifyFormat("class X {\n" |