diff options
author | Nico Weber <nicolasweber@gmx.de> | 2013-01-12 01:28:06 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2013-01-12 01:28:06 +0000 |
commit | 7d37b8bb101c872801e6d2ce82eec377a94ce042 (patch) | |
tree | 1c6d9fd2b75b9f7fb2e4088b43f3d77911e74c72 /unittests/Format/FormatTest.cpp | |
parent | 193649c2a3ff0616777de934a2bf47eaeb4f1076 (diff) |
Formatter: add a test for :? in []
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 2c1c9ee659..061ac5710d 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -797,6 +797,13 @@ TEST_F(FormatTest, BreaksConditionalExpressions) { " aaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaa);"); } +TEST_F(FormatTest, ConditionalExpressionsInBrackets) { + verifyFormat("arr[foo ? bar : baz];"); + verifyFormat("f()[foo ? bar : baz];"); + verifyFormat("(a + b)[foo ? bar : baz];"); + verifyFormat("arr[foo ? (4 > 5 ? 4 : 5) : 5 < 5 ? 5 : 7];"); +} + TEST_F(FormatTest, AlignsStringLiterals) { verifyFormat("loooooooooooooooooooooooooongFunction(\"short literal \"\n" " \"short literal\");"); |