diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | clang/test/Refactor/LocalRename/Field.cpp | 9 | ||||
-rw-r--r-- | clang/test/Refactor/tool-common-options.c | 6 | ||||
-rw-r--r-- | clang/test/Refactor/tool-test-support.c | 41 | ||||
-rw-r--r-- | clang/test/clang-rename/Field.cpp | 15 |
5 files changed, 57 insertions, 15 deletions
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index 084f405fee5..a3a70282a7d 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -48,6 +48,7 @@ list(APPEND CLANG_TEST_DEPS clang-offload-bundler clang-import-test clang-rename + clang-refactor clang-diff ) diff --git a/clang/test/Refactor/LocalRename/Field.cpp b/clang/test/Refactor/LocalRename/Field.cpp new file mode 100644 index 00000000000..db8ada5fcc0 --- /dev/null +++ b/clang/test/Refactor/LocalRename/Field.cpp @@ -0,0 +1,9 @@ +// RUN: clang-refactor local-rename -selection=test:%s -no-dbs %s | FileCheck %s + +class Baz { + int /*range=*/Foo; // CHECK: int /*range=*/Bar; +public: + Baz(); +}; + +Baz::Baz() : /*range=*/Foo(0) {} // CHECK: Baz::Baz() : /*range=*/Bar(0) {}; diff --git a/clang/test/Refactor/tool-common-options.c b/clang/test/Refactor/tool-common-options.c new file mode 100644 index 00000000000..e20c290ae77 --- /dev/null +++ b/clang/test/Refactor/tool-common-options.c @@ -0,0 +1,6 @@ +// RUN: not clang-refactor 2>&1 | FileCheck --check-prefix=MISSING_ACTION %s +// MISSING_ACTION: error: no refactoring action given +// MISSING_ACTION-NEXT: note: the following actions are supported: + +// RUN: not clang-refactor local-rename -no-dbs 2>&1 | FileCheck --check-prefix=MISSING_SOURCES %s +// MISSING_SOURCES: error: must provide paths to the source files when '-no-dbs' is used diff --git a/clang/test/Refactor/tool-test-support.c b/clang/test/Refactor/tool-test-support.c new file mode 100644 index 00000000000..3eb8d22f518 --- /dev/null +++ b/clang/test/Refactor/tool-test-support.c @@ -0,0 +1,41 @@ +// RUN: clang-refactor local-rename -selection=test:%s -no-dbs -v %s 2>&1 | FileCheck %s + +/*range=*/int test; + +/*range named=*/int test2; + +/*range= +1*/int test3; + +/* range = +100 */int test4; + +/*range named =+0*/int test5; + +// CHECK: Test selection group '': +// CHECK-NEXT: 100-100 +// CHECK-NEXT: 153-153 +// CHECK-NEXT: 192-192 +// CHECK-NEXT: Test selection group 'named': +// CHECK-NEXT: 127-127 +// CHECK-NEXT: 213-213 + +// The following invocations are in the default group: + +// CHECK: invoking action 'local-rename': +// CHECK-NEXT: -selection={{.*}}tool-test-support.c:3:11 + +// CHECK: invoking action 'local-rename': +// CHECK-NEXT: -selection={{.*}}tool-test-support.c:7:15 + +// CHECK: invoking action 'local-rename': +// CHECK-NEXT: -selection={{.*}}tool-test-support.c:9:29 + + +// The following invocations are in the 'named' group, and they follow +// the default invocation even if some of their ranges occur prior to the +// ranges from the default group because the groups are tested one-by-one: + +// CHECK: invoking action 'local-rename': +// CHECK-NEXT: -selection={{.*}}tool-test-support.c:5:17 + +// CHECK: invoking action 'local-rename': +// CHECK-NEXT: -selection={{.*}}tool-test-support.c:11:20 diff --git a/clang/test/clang-rename/Field.cpp b/clang/test/clang-rename/Field.cpp deleted file mode 100644 index c0e9a019e47..00000000000 --- a/clang/test/clang-rename/Field.cpp +++ /dev/null @@ -1,15 +0,0 @@ -class Baz { - int Foo; /* Test 1 */ // CHECK: int Bar; -public: - Baz(); -}; - -Baz::Baz() : Foo(0) /* Test 2 */ {} // CHECK: Baz::Baz() : Bar(0) - -// Test 1. -// RUN: clang-rename -offset=18 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s -// Test 2. -// RUN: clang-rename -offset=89 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s - -// To find offsets after modifying the file, use: -// grep -Ubo 'Foo.*' <file> |