From fdc82ccb3f2b23a89e7002fe8238e1422b00f96a Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 9 Jan 2017 21:23:21 +0000 Subject: Vendor import of clang trunk r291476: https://llvm.org/svn/llvm-project/cfe/trunk@291476 --- unittests/Format/FormatTest.cpp | 4 ++++ unittests/Format/FormatTestJS.cpp | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'unittests/Format') diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 6f9df680eef5b..629e85803d64a 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -5780,6 +5780,10 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyGoogleFormat("MACRO Constructor(const int& i) : a(a), b(b) {}"); verifyFormat("void f() { f(a, c * d); }"); verifyFormat("void f() { f(new a(), c * d); }"); + verifyFormat("void f(const MyOverride &override);"); + verifyFormat("void f(const MyFinal &final);"); + verifyIndependentOfContext("bool a = f() && override.f();"); + verifyIndependentOfContext("bool a = f() && final.f();"); verifyIndependentOfContext("InvalidRegions[*R] = 0;"); diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index 59f4a4f6dcfe0..230717fe47cc4 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -858,6 +858,26 @@ TEST_F(FormatTestJS, AutomaticSemicolonInsertionHeuristic) { "return 1", "a = null\n" " return 1"); + verifyFormat( + "x = {\n" + " a: 1\n" + "}\n" + "class Y {}", + " x = {a : 1}\n" + " class Y { }"); +} + +TEST_F(FormatTestJS, ImportExportASI) { + verifyFormat( + "import {x} from 'y'\n" + "export function z() {}", + "import {x} from 'y'\n" + " export function z() {}"); + verifyFormat( + "export {x}\n" + "class Y {}", + " export {x}\n" + " class Y {\n}"); } TEST_F(FormatTestJS, ClosureStyleCasts) { -- cgit v1.2.3