llvm-project
70 строк · 4.3 Кб
1// RUN: mkdir -p %T/move-function
2// RUN: cat %S/Inputs/function_test.h > %T/move-function/function_test.h
3// RUN: cat %S/Inputs/function_test.cpp > %T/move-function/function_test.cpp
4// RUN: cd %T/move-function
5// RUN: clang-move -names="g" -new_header=%T/move-function/new_function_test.h -old_header=../move-function/function_test.h %T/move-function/function_test.cpp --
6// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s
7//
8// CHECK-NEW-TEST-H-CASE1: #ifndef {{.*}}NEW_FUNCTION_TEST_H
9// CHECK-NEW-TEST-H-CASE1: #define {{.*}}NEW_FUNCTION_TEST_H
10// CHECK-NEW-TEST-H-CASE1: {{[[:space:]]+}}
11// CHECK-NEW-TEST-H-CASE1: inline int g() { return 0; }
12// CHECK-NEW-TEST-H-CASE1: {{[[:space:]]+}}
13// CHECK-NEW-TEST-H-CASE1: #endif // {{.*}}NEW_FUNCTION_TEST_H
14//
15// RUN: cp %S/Inputs/function_test* %T/move-function
16// RUN: clang-move -names="h" -new_header=%T/move-function/new_function_test.h -old_header=../move-function/function_test.h %T/move-function/function_test.cpp --
17// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s
18//
19// CHECK-NEW-TEST-H-CASE2: #ifndef {{.*}}NEW_FUNCTION_TEST_H
20// CHECK-NEW-TEST-H-CASE2: #define {{.*}}NEW_FUNCTION_TEST_H
21// CHECK-NEW-TEST-H-CASE2: {{[[:space:]]+}}
22// CHECK-NEW-TEST-H-CASE2: template <typename T> void h(T t) {}
23// CHECK-NEW-TEST-H-CASE2: {{[[:space:]]+}}
24// CHECK-NEW-TEST-H-CASE2: template <> void h(int t) {}
25// CHECK-NEW-TEST-H-CASE2: {{[[:space:]]+}}
26// CHECK-NEW-TEST-H-CASE2: #endif // {{.*}}NEW_FUNCTION_TEST_H
27//
28// RUN: cp %S/Inputs/function_test* %T/move-function
29// RUN: clang-move -names="f" -new_header=%T/move-function/new_function_test.h -new_cc=%T/move-function/new_function_test.cpp -old_header=../move-function/function_test.h -old_cc=../move-function/function_test.cpp %T/move-function/function_test.cpp --
30// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE3 %s
31// RUN: FileCheck -input-file=%T/move-function/new_function_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE3 %s
32//
33// CHECK-NEW-TEST-H-CASE3: #ifndef {{.*}}NEW_FUNCTION_TEST_H
34// CHECK-NEW-TEST-H-CASE3: #define {{.*}}NEW_FUNCTION_TEST_H
35// CHECK-NEW-TEST-H-CASE3: {{[[:space:]]+}}
36// CHECK-NEW-TEST-H-CASE3: void f();
37// CHECK-NEW-TEST-H-CASE3: {{[[:space:]]+}}
38// CHECK-NEW-TEST-H-CASE3: #endif // {{.*}}NEW_FUNCTION_TEST_H
39// CHECK-NEW-TEST-CPP-CASE3: #include "{{.*}}new_function_test.h"
40// CHECK-NEW-TEST-CPP-CASE3: {{[[:space:]]+}}
41// CHECK-NEW-TEST-CPP-CASE3: void f() {}
42//
43// RUN: cat %S/Inputs/function_test.h > %T/move-function/function_test.h
44// RUN: cat %S/Inputs/function_test.cpp > %T/move-function/function_test.cpp
45// RUN: clang-move -names="A::f" -new_header=%T/move-function/new_function_test.h -new_cc=%T/move-function/new_function_test.cpp -old_header=../move-function/function_test.h -old_cc=../move-function/function_test.cpp %T/move-function/function_test.cpp -dump_result -- | FileCheck %s -check-prefix=CHECK-EMPTY
46//
47// CHECK-EMPTY: [{{[[:space:]]*}}]
48//
49// RUN: cat %S/Inputs/function_test.h > %T/move-function/function_test.h
50// RUN: cat %S/Inputs/function_test.cpp > %T/move-function/function_test.cpp
51// RUN: clang-move -names="f,A" -new_header=%T/move-function/new_function_test.h -new_cc=%T/move-function/new_function_test.cpp -old_header=../move-function/function_test.h -old_cc=../move-function/function_test.cpp %T/move-function/function_test.cpp --
52// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE4 %s
53// RUN: FileCheck -input-file=%T/move-function/new_function_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE4 %s
54
55// CHECK-NEW-TEST-H-CASE4: #ifndef {{.*}}NEW_FUNCTION_TEST_H
56// CHECK-NEW-TEST-H-CASE4: #define {{.*}}NEW_FUNCTION_TEST_H
57// CHECK-NEW-TEST-H-CASE4: {{[[:space:]]+}}
58// CHECK-NEW-TEST-H-CASE4: void f();
59// CHECK-NEW-TEST-H-CASE4: {{[[:space:]]+}}
60// CHECK-NEW-TEST-H-CASE4: class A {
61// CHECK-NEW-TEST-H-CASE4: public:
62// CHECK-NEW-TEST-H-CASE4: void f();
63// CHECK-NEW-TEST-H-CASE4: };
64// CHECK-NEW-TEST-H-CASE4: {{[[:space:]]+}}
65// CHECK-NEW-TEST-H-CASE4: #endif // {{.*}}NEW_FUNCTION_TEST_H
66// CHECK-NEW-TEST-CPP-CASE4: #include "{{.*}}new_function_test.h"
67// CHECK-NEW-TEST-CPP-CASE4: {{[[:space:]]+}}
68// CHECK-NEW-TEST-CPP-CASE4: void f() {}
69// CHECK-NEW-TEST-CPP-CASE4: {{[[:space:]]+}}
70// CHECK-NEW-TEST-CPP-CASE4: void A::f() {}
71