From 0eb40cfa6fa16626f4bddb25132722b42400b385 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Mon, 13 Jun 2016 00:49:54 +0000 Subject: clang-format: [JS] post-fix non-null assertion operator. Summary: Do not insert whitespace preceding the "!" postfix operator. This is an incomplete fix, but should cover common usage. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21204 llvm-svn: 272524 --- clang/unittests/Format/FormatTestJS.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/unittests/Format/FormatTestJS.cpp') diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 3d9677922cf..ffcc34d971f 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1293,5 +1293,14 @@ TEST_F(FormatTestJS, SupportShebangLines) { "var x = hello();"); } +TEST_F(FormatTestJS, NonNullAssertionOperator) { + verifyFormat("let x = foo!.bar();\n"); + verifyFormat("let x = foo ? bar! : baz;\n"); + verifyFormat("let x = !foo;\n"); + verifyFormat("let x = foo[0]!;\n"); + verifyFormat("let x = (foo)!;\n"); + verifyFormat("let x = {foo: 1}!;\n"); +} + } // end namespace tooling } // end namespace clang -- cgit v1.2.3