1// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: {readability-braces-around-statements.ShortStatementLines: 4}}" --
2
3void do_something(const char *) {}
4
5bool cond(const char *) {
6 return false;
7}
8
9void 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
20 if (cond("if4") /*comment*/)
21 // some comment
22 do_something("many"
23 "many"
24 "many"
25 "many"
26 "lines");
27 // CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces
28 // CHECK-FIXES: if (cond("if4") /*comment*/) {
29 // CHECK-FIXES: }
30}
31

source code of clang-tools-extra/test/clang-tidy/checkers/readability/braces-around-statements-few-lines.cpp