1 // RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 2}]}" --
2
do_something(const char *)3 void do_something(const char *) {}
4
cond(const char *)5 bool cond(const char *) {
6 return false;
7 }
8
test()9 void test() {
10 if (cond("if1") /*comment*/) do_something("same-line");
11
12 if (cond("if2"))
13 do_something("single-line");
14
15 if (cond("if3") /*comment*/)
16 // some comment
17 do_something("three"
18 "lines");
19 // CHECK-MESSAGES: :[[@LINE-4]]:31: warning: statement should be inside braces
20 // CHECK-FIXES: if (cond("if3") /*comment*/) {
21 // CHECK-FIXES: }
22
23 if (cond("if4") /*comment*/)
24 // some comment
25 do_something("many"
26 "many"
27 "many"
28 "many"
29 "lines");
30 // CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces
31 // CHECK-FIXES: if (cond("if4") /*comment*/) {
32 // CHECK-FIXES: }
33 }
34