xref: /llvm-project/clang/test/Format/dump-config-list-override.cpp (revision e0ff5a8410ea58ba3d2e75791789a28ce976a7e7)
1 /// Check that the ForEachMacros, etc. config entries replace default values instead of appending
2 /// FIXME: clang-format currently start overriding at index 0 (keeping the remaining
3 /// values) instead of either appending or completely replacing the values.
4 /// This behaviour is highly confusing. For now this test documents the current state.
5 // RUN: clang-format -style="{BasedOnStyle: LLVM}" -dump-config %s | \
6 // RUN:   FileCheck %s --check-prefixes=CHECK,DEFAULT
7 // RUN: clang-format -style="{BasedOnStyle: LLVM, ForEachMacros: ['OVERRIDE_FOREACH']}" -dump-config %s | \
8 // RUN:   FileCheck %s --check-prefixes=CHECK,OVERRIDE,FIXME-SHOULD-NOT-BE
9 // RUN: clang-format -style="{BasedOnStyle: LLVM, ForEachMacros: ['M1', 'M2', 'M3', 'M4']}" -dump-config %s | \
10 // RUN:   FileCheck %s --check-prefixes=CHECK,MORE-ENTRIES-THAN-DEFAULT
11 
12 
13 // CHECK-LABEL:   ForEachMacros:
14 // DEFAULT-NEXT:  {{^  }}- foreach
15 // DEFAULT-NEXT:  {{^  }}- Q_FOREACH
16 // DEFAULT-NEXT:  {{^  }}- BOOST_FOREACH
17 // OVERRIDE-NEXT: {{^  }}- OVERRIDE_FOREACH
18 // FIXME-SHOULD-NOT-BE-NEXT:  {{^  }}- Q_FOREACH
19 // FIXME-SHOULD-NOT-BE-NEXT:  {{^  }}- BOOST_FOREACH
20 // MORE-ENTRIES-THAN-DEFAULT-NEXT: {{^  }}- M1
21 // MORE-ENTRIES-THAN-DEFAULT-NEXT: {{^  }}- M2
22 // MORE-ENTRIES-THAN-DEFAULT-NEXT: {{^  }}- M3
23 // MORE-ENTRIES-THAN-DEFAULT-NEXT: {{^  }}- M4
24 // CHECK-NEXT:    {{^[F-Z]}}
25