diff options
author | Martin Probst <martin@probst.io> | 2016-06-23 21:51:49 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2016-06-23 21:51:49 +0000 |
commit | 680a3ebe3c770f6b9e38f9f6fd5f8179586cb89a (patch) | |
tree | dd796c1e2fb6ac8b7ed6b28662db4f16062b92a4 /unittests | |
parent | 934217e9c9d28a9d630c9cbec73885180c9bc32b (diff) |
clang-format: [JS] handle conditionals in fields, default params.
Summary:
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D21658
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273619 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTestJS.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index bd5a505d59..3b9667d5ca 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -1253,7 +1253,6 @@ TEST_F(FormatTestJS, OptionalTypes) { verifyFormat("interface X {\n" " y?(): z;\n" "}"); - verifyFormat("x ? 1 : 2;"); verifyFormat("constructor({aa}: {\n" " aa?: string,\n" " aaaaaaaa?: string,\n" @@ -1350,5 +1349,14 @@ TEST_F(FormatTestJS, NonNullAssertionOperator) { verifyFormat("let x = {foo: 1}!;\n"); } +TEST_F(FormatTestJS, Conditional) { + verifyFormat("y = x ? 1 : 2;"); + verifyFormat("x ? 1 : 2;"); + verifyFormat("class Foo {\n" + " field = true ? 1 : 2;\n" + " method(a = true ? 1 : 2) {}\n" + "}"); +} + } // end namespace tooling } // end namespace clang |