Debian Codegraph @

clang-tools-extra/test/clang-move/move-var.cpp

raw
1 // RUN: mkdir -p %T/move-var
2 // RUN: cp %S/Inputs/var_test* %T/move-var
3 // RUN: cd %T/move-var
4 // RUN: clang-move -names="a::kGlobalInt" -new_header=%T/move-var/new_var_test.h -old_header=../move-var/var_test.h -old_cc=../move-var/var_test.cpp -new_cc=%T/move-var/new_var_test.cpp %T/move-var/var_test.cpp --
5 // RUN: FileCheck -input-file=%T/move-var/var_test.h -check-prefix=CHECK-OLD-VAR-H-CASE1 %s
6 // RUN: FileCheck -input-file=%T/move-var/var_test.cpp -check-prefix=CHECK-OLD-VAR-CPP-CASE1 %s
7 // RUN: FileCheck -input-file=%T/move-var/new_var_test.h -check-prefix=CHECK-NEW-VAR-H-CASE1 %s
8 // RUN: FileCheck -input-file=%T/move-var/new_var_test.cpp -check-prefix=CHECK-NEW-VAR-CPP-CASE1 %s
9
10 // CHECK-OLD-VAR-H-CASE1-NOT: extern int kGlobalInt;
11 // CHECK-OLD-VAR-H-CASE1: int kGlobalInt = 3;
12
13 // CHECK-OLD-VAR-CPP-CASE1-NOT: int kGlobalInt = 1;
14
15 // CHECK-NEW-VAR-H-CASE1: extern int kGlobalInt;
16 // CHECK-NEW-VAR-H-CASE1-NOT: int kGlobalInt = 3;
17
18 // CHECK-NEW-VAR-CPP-CASE1: int kGlobalInt = 1;
19
20
21 // RUN: cp %S/Inputs/var_test* %T/move-var
22 // RUN: clang-move -names="a::kGlobalStr" -new_header=%T/move-var/new_var_test.h -old_header=../move-var/var_test.h -old_cc=../move-var/var_test.cpp -new_cc=%T/move-var/new_var_test.cpp %T/move-var/var_test.cpp --
23 // RUN: FileCheck -input-file=%T/move-var/var_test.h -check-prefix=CHECK-OLD-VAR-H-CASE2 %s
24 // RUN: FileCheck -input-file=%T/move-var/var_test.cpp -check-prefix=CHECK-OLD-VAR-CPP-CASE2 %s
25 // RUN: FileCheck -input-file=%T/move-var/new_var_test.h -check-prefix=CHECK-NEW-VAR-H-CASE2 %s
26 // RUN: FileCheck -input-file=%T/move-var/new_var_test.cpp -check-prefix=CHECK-NEW-VAR-CPP-CASE2 %s
27
28 // CHECK-OLD-VAR-H-CASE2-NOT: extern const char *const kGlobalStr;
29 // CHECK-OLD-VAR-H-CASE2: const char *const kGlobalStr = "Hello2";
30
31 // CHECK-OLD-VAR-CPP-CASE2-NOT: const char *const kGlobalStr = "Hello";
32
33 // CHECK-NEW-VAR-H-CASE2: extern const char *const kGlobalStr;
34 // CHECK-NEW-VAR-H-CASE2-NOT: const char *const kGlobalStr = "Hello2";
35
36 // CHECK-NEW-VAR-CPP-CASE2: const char *const kGlobalStr = "Hello";
37
38
39 // RUN: cp %S/Inputs/var_test* %T/move-var
40 // RUN: clang-move -names="kEvilInt" -new_header=%T/move-var/new_var_test.h -old_header=../move-var/var_test.h -old_cc=../move-var/var_test.cpp -new_cc=%T/move-var/new_var_test.cpp %T/move-var/var_test.cpp --
41 // RUN: FileCheck -input-file=%T/move-var/var_test.h -check-prefix=CHECK-OLD-VAR-H-CASE3 %s
42 // RUN: FileCheck -input-file=%T/move-var/new_var_test.h -check-prefix=CHECK-NEW-VAR-H-CASE3 %s
43
44 // CHECK-OLD-VAR-H-CASE3-NOT: int kEvilInt = 2;
45
46 // CHECK-NEW-VAR-H-CASE3: int kEvilInt = 2;