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-EMPTY -allow-empty %s
13 // RUN: FileCheck -input-file=%T/clang-move/include/test.h -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
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-EMPTY -allow-empty %s
22 // RUN: FileCheck -input-file=%T/clang-move/include/test.h -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
23 //
24 //
25 // CHECK-NEW-TEST-H: #ifndef TEST_H // comment 1
26 // CHECK-NEW-TEST-H: #define TEST_H
27 // CHECK-NEW-TEST-H: namespace a {
28 // CHECK-NEW-TEST-H: class Foo {
29 // CHECK-NEW-TEST-H: public:
30 // CHECK-NEW-TEST-H:   int f();
31 // CHECK-NEW-TEST-H:   int f2(int a, int b);
32 // CHECK-NEW-TEST-H: };
33 // CHECK-NEW-TEST-H: } // namespace a
34 // CHECK-NEW-TEST-H: #endif // TEST_H
35 //
36 // CHECK-NEW-TEST-CPP: #include "{{.*}}new_test.h"
37 // CHECK-NEW-TEST-CPP: #include "test2.h"
38 // CHECK-NEW-TEST-CPP: namespace a {
39 // CHECK-NEW-TEST-CPP: int Foo::f() { return 0; }
40 // CHECK-NEW-TEST-CPP: int Foo::f2(int a, int b) { return a + b; }
41 // CHECK-NEW-TEST-CPP: } // namespace a
42 //
43 // CHECK-OLD-TEST-EMPTY: {{^}}{{$}}
44