Formatter: add a test for :? in []

llvm-svn: 172289
This commit is contained in:
Nico Weber 2013-01-12 01:28:06 +00:00
parent 556ff61122
commit 4a5030c72f
1 changed files with 7 additions and 0 deletions

View File

@ -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\");");