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