From b9a4990a9ce18e567e13a23732425143e5cfee3e Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Sat, 9 Jan 2016 15:56:28 +0000 Subject: 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 --- clang/unittests/Format/FormatTestJS.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') 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>;"); @@ -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" -- cgit v1.2.3