xref: /llvm-project/clang-tools-extra/test/clang-include-fixer/commandline_options.cpp (revision 43356f56bd2ede05c70db537e3f8b50a31444487)
1*43356f56SNico Weber // RUN: echo "foo f;" > %t.cpp
2*43356f56SNico Weber // RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -output-headers %t.cpp -- | FileCheck %s
3*43356f56SNico Weber // RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='{FilePath: "%/t.cpp", QuerySymbolInfos: [{RawIdentifier: foo, Range: {Offset: 0, Length: 3}}], HeaderInfos: [{Header: "\"foo.h\"", QualifiedName: "foo"}]}' %t.cpp | FileCheck %s -check-prefix=CHECK-CODE
4*43356f56SNico Weber // RUN: cat %t.cpp | not clang-include-fixer -stdin -insert-header='{FilePath: "%/t.cpp", QuerySymbolInfos: [{RawIdentifier: foo, Range: {Offset: 0, Length: 3}}], HeaderInfos: [{Header: "\"foo.h\"", QualifiedName: "foo"},{Header: "\"foo2.h\"", QualifiedName: "foo"}]}' %t.cpp
5*43356f56SNico Weber // RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='{FilePath: "%/t.cpp", QuerySymbolInfos: [{RawIdentifier: foo, Range: {Offset: 0, Length: 3}}], HeaderInfos: [{Header: "\"foo.h\"", QualifiedName: "a:foo"},{Header: "\"foo.h\"", QualifiedName: "b:foo"}]}' %t.cpp
6*43356f56SNico Weber //
7*43356f56SNico Weber // CHECK:     "HeaderInfos": [
8*43356f56SNico Weber // CHECK-NEXT:  {"Header": "\"foo.h\"",
9*43356f56SNico Weber // CHECK-NEXT:   "QualifiedName": "foo"},
10*43356f56SNico Weber // CHECK-NEXT:  {"Header": "\"bar.h\"",
11*43356f56SNico Weber // CHECK-NEXT:   "QualifiedName": "foo"}
12*43356f56SNico Weber // CHECK-NEXT:]
13*43356f56SNico Weber //
14*43356f56SNico Weber // CHECK-CODE: #include "foo.h"
15*43356f56SNico Weber // CHECK-CODE: foo f;
16