xref: /llvm-project/clang-tools-extra/test/clang-move/move-class.cpp (revision 7bd492c53a6cafcefaa968fdc1f18416b58cb17c)
1 // RUN: mkdir -p %T/clang-move/build
2 // RUN: mkdir -p %T/clang-move/include
3 // RUN: mkdir -p %T/clang-move/src
4 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json
5 // RUN: cp %S/Inputs/test.h  %T/clang-move/include
6 // RUN: cp %S/Inputs/test.cpp %T/clang-move/src
7 // RUN: touch %T/clang-move/include/test2.h
8 // RUN: cd %T/clang-move/build
9 // RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../src/test.cpp -old_header=../include/test.h %T/clang-move/src/test.cpp
10 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
11 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
12 // RUN: FileCheck -input-file=%T/clang-move/src/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
13 // RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}'
14 //
15 // RUN: cp %S/Inputs/test.h  %T/clang-move/include
16 // RUN: cp %S/Inputs/test.cpp %T/clang-move/src
17 // RUN: cd %T/clang-move/build
18 // RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/src/test.cpp -old_header=%T/clang-move/include/test.h %T/clang-move/src/test.cpp
19 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
20 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
21 // RUN: FileCheck -input-file=%T/clang-move/src/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
22 // RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}'
23 //
24 // CHECK-NEW-TEST-H: namespace a {
25 // CHECK-NEW-TEST-H: class Foo {
26 // CHECK-NEW-TEST-H: public:
27 // CHECK-NEW-TEST-H:   int f();
28 // CHECK-NEW-TEST-H:   int f2(int a, int b);
29 // CHECK-NEW-TEST-H: };
30 // CHECK-NEW-TEST-H: } // namespace a
31 //
32 // CHECK-NEW-TEST-CPP: #include "{{.*}}new_test.h"
33 // CHECK-NEW-TEST-CPP: #include "test2.h"
34 // CHECK-NEW-TEST-CPP: namespace a {
35 // CHECK-NEW-TEST-CPP: int Foo::f() { return 0; }
36 // CHECK-NEW-TEST-CPP: int Foo::f2(int a, int b) { return a + b; }
37 // CHECK-NEW-TEST-CPP: } // namespace a
38 //
39 // CHECK-OLD-TEST-CPP: #include "test.h"
40 // CHECK-OLD-TEST-CPP: #include "test2.h"
41