From b7fda11572dd4b3aad889743cd790565e1ccd43d Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Thu, 11 Feb 2016 13:24:15 +0000 Subject: clang-format: [JS] Support for (.. of ..) loops. Before: for (var i of[2, 3]) {} After: for (var i of [2, 3]) {} llvm-svn: 260518 --- clang/unittests/Format/FormatTestJS.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 7fad83aab12..e08c876a5c6 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -595,6 +595,8 @@ TEST_F(FormatTestJS, ReturnStatements) { TEST_F(FormatTestJS, ForLoops) { verifyFormat("for (var i in [2, 3]) {\n" "}"); + verifyFormat("for (var i of [2, 3]) {\n" + "}"); } TEST_F(FormatTestJS, AutomaticSemicolonInsertion) { @@ -758,6 +760,7 @@ TEST_F(FormatTestJS, TypeAnnotations) { 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("for (var y: string of x) {\n x();\n}"); verifyFormat("function x(y: {a?: number;} = {}): number {\n" " return 12;\n" "}"); -- cgit v1.2.3