87 lines · cpp
1// RUN: mkdir -p %t.dir/move-template-class2// RUN: cp %S/Inputs/template_class_test* %t.dir/move-template-class3// RUN: cd %t.dir/move-template-class4// RUN: clang-move -names="A,B" -new_cc=%t.dir/move-template-class/new_template_class_test.cpp -new_header=%t.dir/move-template-class/new_template_class_test.h -old_cc=%t.dir/move-template-class/template_class_test.cpp -old_header=../move-template-class/template_class_test.h %t.dir/move-template-class/template_class_test.cpp --5// RUN: FileCheck -input-file=%t.dir/move-template-class/template_class_test.cpp -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s6// RUN: FileCheck -input-file=%t.dir/move-template-class/template_class_test.h -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s7// RUN: FileCheck -input-file=%t.dir/move-template-class/new_template_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE1 %s8// RUN: FileCheck -input-file=%t.dir/move-template-class/new_template_class_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s9//10// RUN: cp %S/Inputs/template_class_test* %t.dir/move-template-class11// RUN: clang-move -names="A" -new_cc=%t.dir/move-template-class/new_template_class_test.cpp -new_header=%t.dir/move-template-class/new_template_class_test.h -old_cc=%t.dir/move-template-class/template_class_test.cpp -old_header=../move-template-class/template_class_test.h %t.dir/move-template-class/template_class_test.cpp --12// RUN: FileCheck -input-file=%t.dir/move-template-class/template_class_test.h -check-prefix=CHECK-OLD-TEST-H-CASE2 %s13// RUN: FileCheck -input-file=%t.dir/move-template-class/template_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP-CASE2 %s14// RUN: FileCheck -input-file=%t.dir/move-template-class/new_template_class_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s15// RUN: FileCheck -input-file=%t.dir/move-template-class/new_template_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE2 %s16//17//18// CHECK-OLD-TEST-EMPTY: {{^}}{{$}}19//20// CHECK-NEW-TEST-H-CASE1: #ifndef TEMPLATE_CLASS_TEST_H // comment 121// CHECK-NEW-TEST-H-CASE1: #define TEMPLATE_CLASS_TEST_H22// 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_H44//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 156// CHECK-OLD-TEST-H-CASE2: #define TEMPLATE_CLASS_TEST_H57// 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_H62//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_H67// CHECK-NEW-TEST-H-CASE2: #define {{.*}}NEW_TEMPLATE_CLASS_TEST_H68// 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_H82//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