aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Refactor
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Refactor')
-rw-r--r--clang/test/Refactor/LocalRename/Field.cpp9
-rw-r--r--clang/test/Refactor/tool-common-options.c6
-rw-r--r--clang/test/Refactor/tool-test-support.c41
3 files changed, 56 insertions, 0 deletions
diff --git a/clang/test/Refactor/LocalRename/Field.cpp b/clang/test/Refactor/LocalRename/Field.cpp
new file mode 100644
index 0000000..db8ada5
--- /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 0000000..e20c290
--- /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 0000000..3eb8d22f5
--- /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