move-template-class.cpp
4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// RUN: mkdir -p %T/move-template-class
// RUN: cp %S/Inputs/template_class_test* %T/move-template-class
// RUN: cd %T/move-template-class
// RUN: clang-move -names="A,B" -new_cc=%T/move-template-class/new_template_class_test.cpp -new_header=%T/move-template-class/new_template_class_test.h -old_cc=%T/move-template-class/template_class_test.cpp -old_header=../move-template-class/template_class_test.h %T/move-template-class/template_class_test.cpp --
// RUN: FileCheck -input-file=%T/move-template-class/template_class_test.cpp -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
// RUN: FileCheck -input-file=%T/move-template-class/template_class_test.h -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
// RUN: FileCheck -input-file=%T/move-template-class/new_template_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE1 %s
// RUN: FileCheck -input-file=%T/move-template-class/new_template_class_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s
//
// RUN: cp %S/Inputs/template_class_test* %T/move-template-class
// RUN: clang-move -names="A" -new_cc=%T/move-template-class/new_template_class_test.cpp -new_header=%T/move-template-class/new_template_class_test.h -old_cc=%T/move-template-class/template_class_test.cpp -old_header=../move-template-class/template_class_test.h %T/move-template-class/template_class_test.cpp --
// RUN: FileCheck -input-file=%T/move-template-class/template_class_test.h -check-prefix=CHECK-OLD-TEST-H-CASE2 %s
// RUN: FileCheck -input-file=%T/move-template-class/template_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP-CASE2 %s
// RUN: FileCheck -input-file=%T/move-template-class/new_template_class_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s
// RUN: FileCheck -input-file=%T/move-template-class/new_template_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE2 %s
//
//
// CHECK-OLD-TEST-EMPTY: {{^}}{{$}}
//
// CHECK-NEW-TEST-H-CASE1: #ifndef TEMPLATE_CLASS_TEST_H // comment 1
// CHECK-NEW-TEST-H-CASE1: #define TEMPLATE_CLASS_TEST_H
// CHECK-NEW-TEST-H-CASE1: template <typename T>
// CHECK-NEW-TEST-H-CASE1: class A {
// CHECK-NEW-TEST-H-CASE1: public:
// CHECK-NEW-TEST-H-CASE1: void f();
// CHECK-NEW-TEST-H-CASE1: void g();
// CHECK-NEW-TEST-H-CASE1: template <typename U> void h();
// CHECK-NEW-TEST-H-CASE1: template <typename U> void k();
// CHECK-NEW-TEST-H-CASE1: static int b;
// CHECK-NEW-TEST-H-CASE1: static int c;
// CHECK-NEW-TEST-H-CASE1: };
// CHECK-NEW-TEST-H-CASE1: template <typename T>
// CHECK-NEW-TEST-H-CASE1: void A<T>::f() {}
// CHECK-NEW-TEST-H-CASE1: template <typename T>
// CHECK-NEW-TEST-H-CASE1: template <typename U>
// CHECK-NEW-TEST-H-CASE1: void A<T>::h() {}
// CHECK-NEW-TEST-H-CASE1: template <typename T>
// CHECK-NEW-TEST-H-CASE1: int A<T>::b = 2;
// CHECK-NEW-TEST-H-CASE1: class B {
// CHECK-NEW-TEST-H-CASE1: public:
// CHECK-NEW-TEST-H-CASE1: void f();
// CHECK-NEW-TEST-H-CASE1: };
// CHECK-NEW-TEST-H-CASE1: #endif // TEMPLATE_CLASS_TEST_H
//
// CHECK-NEW-TEST-CPP-CASE1: #include "{{.*}}new_template_class_test.h"
// CHECK-NEW-TEST-CPP-CASE1: template <typename T>
// CHECK-NEW-TEST-CPP-CASE1: void A<T>::g() {}
// CHECK-NEW-TEST-CPP-CASE1: template <typename T>
// CHECK-NEW-TEST-CPP-CASE1: template <typename U>
// CHECK-NEW-TEST-CPP-CASE1: void A<T>::k() {}
// CHECK-NEW-TEST-CPP-CASE1: template <typename T>
// CHECK-NEW-TEST-CPP-CASE1: int A<T>::c = 2;
// CHECK-NEW-TEST-CPP-CASE1: void B::f() {}
//
// CHECK-OLD-TEST-H-CASE2: #ifndef TEMPLATE_CLASS_TEST_H // comment 1
// CHECK-OLD-TEST-H-CASE2: #define TEMPLATE_CLASS_TEST_H
// CHECK-OLD-TEST-H-CASE2: class B {
// CHECK-OLD-TEST-H-CASE2: public:
// CHECK-OLD-TEST-H-CASE2: void f();
// CHECK-OLD-TEST-H-CASE2: };
// CHECK-OLD-TEST-H-CASE2: #endif // TEMPLATE_CLASS_TEST_H
//
// CHECK-OLD-TEST-CPP-CASE2: #include "template_class_test.h"
// CHECK-OLD-TEST-CPP-CASE2: void B::f() {}
//
// CHECK-NEW-TEST-H-CASE2: #ifndef {{.*}}NEW_TEMPLATE_CLASS_TEST_H
// CHECK-NEW-TEST-H-CASE2: #define {{.*}}NEW_TEMPLATE_CLASS_TEST_H
// CHECK-NEW-TEST-H-CASE2: template <typename T>
// CHECK-NEW-TEST-H-CASE2: class A {
// CHECK-NEW-TEST-H-CASE2: public:
// CHECK-NEW-TEST-H-CASE2: void f();
// CHECK-NEW-TEST-H-CASE2: void g();
// CHECK-NEW-TEST-H-CASE2: template <typename U> void h();
// CHECK-NEW-TEST-H-CASE2: template <typename U> void k();
// CHECK-NEW-TEST-H-CASE2: static int b;
// CHECK-NEW-TEST-H-CASE2: static int c;
// CHECK-NEW-TEST-H-CASE2: };
// CHECK-NEW-TEST-H-CASE2: template <typename T> void A<T>::f() {}
// CHECK-NEW-TEST-H-CASE2: template <typename T> template <typename U> void A<T>::h() {}
// CHECK-NEW-TEST-H-CASE2: template <typename T> int A<T>::b = 2;
// CHECK-NEW-TEST-H-CASE2: #endif // {{.*}}NEW_TEMPLATE_CLASS_TEST_H
//
// CHECK-NEW-TEST-CPP-CASE2: #include "{{.*}}new_template_class_test.h"
// CHECK-NEW-TEST-CPP-CASE2: template <typename T> void A<T>::g() {}
// CHECK-NEW-TEST-CPP-CASE2: template <typename T> template <typename U> void A<T>::k() {}
// CHECK-NEW-TEST-CPP-CASE2: template <typename T> int A<T>::c = 2;