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