1 // RUN: mkdir -p %T/move-enum
2 // RUN: cp %S/Inputs/enum.h  %T/move-enum/enum.h
3 // RUN: echo '#include "enum.h"' > %T/move-enum/enum.cpp
4 // RUN: cd %T/move-enum
5 //
6 // -----------------------------------------------------------------------------
7 // Test moving enum declarations.
8 // -----------------------------------------------------------------------------
9 // RUN: clang-move -names="a::E1" -new_cc=%T/move-enum/new_test.cpp -new_header=%T/move-enum/new_test.h -old_cc=%T/move-enum/enum.cpp -old_header=%T/move-enum/enum.h %T/move-enum/enum.cpp -- -std=c++11
10 // RUN: FileCheck -input-file=%T/move-enum/new_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s
11 // RUN: FileCheck -input-file=%T/move-enum/enum.h -check-prefix=CHECK-OLD-TEST-H-CASE1 %s
12 //
13 // CHECK-NEW-TEST-H-CASE1: namespace a {
14 // CHECK-NEW-TEST-H-CASE1-NEXT: enum E1 { Green, Red };
15 // CHECK-NEW-TEST-H-CASE1-NEXT: }
16 
17 // CHECK-OLD-TEST-H-CASE1-NOT: enum E1 { Green, Red };
18 
19 
20 // -----------------------------------------------------------------------------
21 // Test moving scoped enum declarations.
22 // -----------------------------------------------------------------------------
23 // RUN: cp %S/Inputs/enum.h  %T/move-enum/enum.h
24 // RUN: echo '#include "enum.h"' > %T/move-enum/enum.cpp
25 // RUN: clang-move -names="a::E2" -new_cc=%T/move-enum/new_test.cpp -new_header=%T/move-enum/new_test.h -old_cc=%T/move-enum/enum.cpp -old_header=%T/move-enum/enum.h %T/move-enum/enum.cpp -- -std=c++11
26 // RUN: FileCheck -input-file=%T/move-enum/new_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s
27 // RUN: FileCheck -input-file=%T/move-enum/enum.h -check-prefix=CHECK-OLD-TEST-H-CASE2 %s
28 
29 // CHECK-NEW-TEST-H-CASE2: namespace a {
30 // CHECK-NEW-TEST-H-CASE2-NEXT: enum class E2 { Yellow };
31 // CHECK-NEW-TEST-H-CASE2-NEXT: }
32 
33 // CHECK-OLD-TEST-H-CASE2-NOT: enum class E2 { Yellow };
34 
35 
36 // -----------------------------------------------------------------------------
37 // Test not moving class-insided enum declarations.
38 // -----------------------------------------------------------------------------
39 // RUN: cp %S/Inputs/enum.h  %T/move-enum/enum.h
40 // RUN: echo '#include "enum.h"' > %T/move-enum/enum.cpp
41 // RUN: clang-move -names="a::C::E3" -new_cc=%T/move-enum/new_test.cpp -new_header=%T/move-enum/new_test.h -old_cc=%T/move-enum/enum.cpp -old_header=%T/move-enum/enum.h %T/move-enum/enum.cpp -- -std=c++11
42 // RUN: FileCheck -input-file=%T/move-enum/new_test.h -allow-empty -check-prefix=CHECK-EMPTY %s
43 
44 // CHECK-EMPTY: {{^}}{{$}}
45