llvm-project/clang/test/Format/error-config.cpp
Nathan James eb9483b210
[format] Add overload to parseConfiguration that accept llvm::MemoryBufferRef
This overload should be used for better diagnostics when parsing configurations.
Now a failure to parse will list the filename (or <command-line>) instead of just `YAML`.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D93633
2020-12-23 12:08:29 +00:00

12 lines
486 B
C++

// RUN: clang-format %s --Wno-error=unknown --style="{UnknownKey: true}" 2>&1 | FileCheck %s -check-prefix=CHECK
// RUN: not clang-format %s --style="{UnknownKey: true}" 2>&1 | FileCheck %s -check-prefix=CHECK-FAIL
// CHECK: <command-line>:1:2: warning: unknown key 'UnknownKey'
// CHECK-NEXT: {UnknownKey: true}
// CHECK-NEXT: ^~~~~~~~~~
// CHECK-FAIL: <command-line>:1:2: error: unknown key 'UnknownKey'
// CHECK-FAIL-NEXT: {UnknownKey: true}
// CHECK-FAIL-NEXT: ^~~~~~~~~~
int i ;