Skip to content

Commit

Permalink
Add integration test for add-test-alias
Browse files Browse the repository at this point in the history
  • Loading branch information
LegalizeAdulthood committed Jan 28, 2024
1 parent 85b03b6 commit a2da4fa
Show file tree
Hide file tree
Showing 19 changed files with 417 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tools/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ function(add_tool_test tool)
set_property(TEST test-${tool}-tool PROPERTY LABELS ${tool} tool)
endfunction()

add_tool_test(add-test-alias
COMMAND Sources Results R 2 3
COMPARE_FILES
Sources/TestRename.cpp
Results/diffs/R1.txt
Results/diffs/R2.txt
Results/diffs/R3.txt
Results/diffs/R4.txt
Results/diffs/R5.txt
Results/diffs/R6.txt
)
add_tool_test(add-tests
COMMAND Sources Results R Sources/TestRename.cpp
COMPARE_FILES
Expand Down
22 changes: 22 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/CLionResults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CLion

## Add Block Delimiter
Case | Result
---- | ------
ABD1 | Pass
ABD2 | Pass
ABD3 | Pass
ABD4 | Pass
ABD5 | Pass
ABD6 | Pass
ABD7 | Pass

## Rename
Case | Result
---- | ------
R1 | Pass
R2 | Pass
R3 | Pass
R4 | Pass
R5 | Failure (selects unrelated names) [1938](https://youtrack.jetbrains.com/issue/CPP-1938)
R6 | Failure (selects unrelated names) [1938](https://youtrack.jetbrains.com/issue/CPP-1938)
22 changes: 22 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/ReSharperCppResults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ReSharper for C++

## Add Block Delimiter
Case | Result
---- | ------
ABD1 | Pass
ABD2 | Pass
ABD3 | Pass
ABD4 | Pass
ABD5 | Pass
ABD6 | Pass
ABD7 | Pass

## Rename
Case | Result
---- | ------
R1 | Pass
R2 | Failure (unavailable) [RSCPP-15796](https://youtrack.jetbrains.com/issue/RSCPP-15796)
R3 | Failure (unavailable) [RSCPP-15796](https://youtrack.jetbrains.com/issue/RSCPP-15796)
R4 | Pass
R5 | Pass
R6 | Pass
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/diffs/R1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..dd356e8 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -10,7 +10,7 @@
// updates all references to the modified element.

// #TEST#: R1 Rename this macro
-#define MACRO_NO_ARGS 3.14159f
+#define GOINK 3.14159f

// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 =R2 Rename the macro argument x_ from usage
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/diffs/R2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..3e43246 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -15,7 +15,7 @@
// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 =R2 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
-#define MACRO_ONE_ARG(x_) (2.0f * x_)
+#define MACRO_ONE_ARG(goink_) (2.0f * goink_)

class Operations
{
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/diffs/R3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..3e43246 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -15,7 +15,7 @@
// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 =R2 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
-#define MACRO_ONE_ARG(x_) (2.0f * x_)
+#define MACRO_ONE_ARG(goink_) (2.0f * goink_)

class Operations
{
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/diffs/R4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..8628cb4 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -15,7 +15,7 @@
// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 =R2 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
-#define MACRO_ONE_ARG(x_) (2.0f * x_)
+#define GOINK(x_) (2.0f * x_)

class Operations
{
27 changes: 27 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/diffs/R5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..a756ebe 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -31,22 +31,22 @@ public:
};

// #TEST#: R5 Rename this class, but class in Rename2.cpp shouldn't be renamed
-class Rename1
+class Goink
{
public:
// #TEST#: R6 Rename this class via its c'tor
- Rename1() : x()
+ Goink() : x()
{
}

- ~Rename1()
+ ~Goink()
{
}

- typedef Rename1 MyClass;
+ typedef Goink MyClass;

void Operation()
27 changes: 27 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Results/diffs/R6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..a756ebe 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -31,22 +31,22 @@ public:
};

// #TEST#: R5 Rename this class, but class in Rename2.cpp shouldn't be renamed
-class Rename1
+class Goink
{
public:
// #TEST#: R6 Rename this class via its c'tor
- Rename1() : x()
+ Goink() : x()
{
}

- ~Rename1()
+ ~Goink()
{
}

- typedef Rename1 MyClass;
+ typedef Goink MyClass;

void Operation()
53 changes: 53 additions & 0 deletions Tools/Tests/add-test-alias/Expected/Sources/TestRename.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "Rename.h"

#include "Require.h"

#include <stdexcept>
#include <string>

// Renames a local variable, function, method, field, property, parameter,
// type, namespace, active CSS style, C++ global variable or C++ macro and
// updates all references to the modified element.

// #TEST#: R1 Rename this macro
#define MACRO_NO_ARGS 3.14159f

// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 =R2 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
#define MACRO_ONE_ARG(x_) (2.0f * x_)

class Operations
{
public:
int Operation1()
{
return 1;
}
int Operation2()
{
return 2;
}
};

// #TEST#: R5 Rename this class, but class in Rename2.cpp shouldn't be renamed
class Rename1
{
public:
// #TEST#: R6 Rename this class via its c'tor
Rename1() : x()
{
}

~Rename1()
{
}

typedef Rename1 MyClass;

void Operation()
{
}

int x;
};
22 changes: 22 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/CLionResults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CLion

## Add Block Delimiter
Case | Result
---- | ------
ABD1 | Pass
ABD2 | Pass
ABD3 | Pass
ABD4 | Pass
ABD5 | Pass
ABD6 | Pass
ABD7 | Pass

## Rename
Case | Result
---- | ------
R1 | Pass
R2 | Pass
R3 | Pass
R4 | Pass
R5 | Failure (selects unrelated names) [1938](https://youtrack.jetbrains.com/issue/CPP-1938)
R6 | Failure (selects unrelated names) [1938](https://youtrack.jetbrains.com/issue/CPP-1938)
22 changes: 22 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/ReSharperCppResults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ReSharper for C++

## Add Block Delimiter
Case | Result
---- | ------
ABD1 | Pass
ABD2 | Pass
ABD3 | Pass
ABD4 | Pass
ABD5 | Pass
ABD6 | Pass
ABD7 | Pass

## Rename
Case | Result
---- | ------
R1 | Pass
R2 | Failure (unavailable) [RSCPP-15796](https://youtrack.jetbrains.com/issue/RSCPP-15796)
R3 | Failure (unavailable) [RSCPP-15796](https://youtrack.jetbrains.com/issue/RSCPP-15796)
R4 | Pass
R5 | Pass
R6 | Pass
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/diffs/R1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..dd356e8 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -10,7 +10,7 @@
// updates all references to the modified element.

// #TEST#: R1 Rename this macro
-#define MACRO_NO_ARGS 3.14159f
+#define GOINK 3.14159f

// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 Rename the macro argument x_ from usage
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/diffs/R2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..3e43246 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -15,7 +15,7 @@
// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
-#define MACRO_ONE_ARG(x_) (2.0f * x_)
+#define MACRO_ONE_ARG(goink_) (2.0f * goink_)

class Operations
{
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/diffs/R3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..3e43246 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -15,7 +15,7 @@
// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
-#define MACRO_ONE_ARG(x_) (2.0f * x_)
+#define MACRO_ONE_ARG(goink_) (2.0f * goink_)

class Operations
{
13 changes: 13 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/diffs/R4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..8628cb4 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -15,7 +15,7 @@
// #TEST#: R2 Rename the macro argument x_ from declaration
// #TEST#: R3 Rename the macro argument x_ from usage
// #TEST#: R4 Rename this macro
-#define MACRO_ONE_ARG(x_) (2.0f * x_)
+#define GOINK(x_) (2.0f * x_)

class Operations
{
27 changes: 27 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/diffs/R5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..a756ebe 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -31,22 +31,22 @@ public:
};

// #TEST#: R5 Rename this class, but class in Rename2.cpp shouldn't be renamed
-class Rename1
+class Goink
{
public:
// #TEST#: R6 Rename this class via its c'tor
- Rename1() : x()
+ Goink() : x()
{
}

- ~Rename1()
+ ~Goink()
{
}

- typedef Rename1 MyClass;
+ typedef Goink MyClass;

void Operation()
27 changes: 27 additions & 0 deletions Tools/Tests/add-test-alias/Inputs/Results/diffs/R6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/Sources/TestRename.cpp b/Sources/TestRename.cpp
index d1c1283..a756ebe 100644
--- a/Sources/TestRename.cpp
+++ b/Sources/TestRename.cpp
@@ -31,22 +31,22 @@ public:
};

// #TEST#: R5 Rename this class, but class in Rename2.cpp shouldn't be renamed
-class Rename1
+class Goink
{
public:
// #TEST#: R6 Rename this class via its c'tor
- Rename1() : x()
+ Goink() : x()
{
}

- ~Rename1()
+ ~Goink()
{
}

- typedef Rename1 MyClass;
+ typedef Goink MyClass;

void Operation()
Loading

0 comments on commit a2da4fa

Please sign in to comment.