-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for add-tests tool
Some things are still hard-coded for add-tests, but this can be generalized for other tools later. Fixes #71
- Loading branch information
1 parent
d1f70cb
commit 3b09cf7
Showing
23 changed files
with
578 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set(INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Inputs) | ||
set(EXPECTED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Expected) | ||
add_test(NAME test-add-tests-tool | ||
COMMAND ${CMAKE_COMMAND} | ||
-DCMAKE_COMMAND:STRING=${CMAKE_COMMAND} | ||
-DTEST_NAME:STRING=add-tests | ||
-DTEST_DIR:STRING=${CMAKE_BINARY_DIR}/ToolTests | ||
-DINPUT_DIR:STRING=${INPUT_DIR} | ||
-DEXPECTED_DIR:STRING=${EXPECTED_DIR} | ||
-DTOOL=$<TARGET_FILE:add-tests> | ||
-P ${CMAKE_CURRENT_SOURCE_DIR}/TestAddTests.cmake | ||
) | ||
set_tests_properties(test-add-tests-tool PROPERTIES LABELS add-tests) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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) | ||
R7 | | ||
R8 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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 | ||
R7 | | ||
R8 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 | ||
@@ -645,7 +645,7 @@ void TestRename() | ||
// #TEST#: R205 rename the variable Y::x | ||
int y = test2.Operation() + X::x + X::y + Y::x; | ||
|
||
- float x = MACRO_NO_ARGS; | ||
+ float x = GOINK; | ||
x = MACRO_ONE_ARG(2.0f); | ||
|
||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 | ||
{ | ||
@@ -646,7 +646,7 @@ void TestRename() | ||
int y = test2.Operation() + X::x + X::y + Y::x; | ||
|
||
float x = MACRO_NO_ARGS; | ||
- x = MACRO_ONE_ARG(2.0f); | ||
+ x = GOINK(2.0f); | ||
|
||
{ | ||
// #TEST#: R206 Rename the namespace X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 =R5 Rename this class via its c'tor | ||
- Rename1() : x() | ||
+ Goink() : x() | ||
{ | ||
} | ||
|
||
// #TEST#: R7 =R5 Rename this class via its d'tor | ||
- ~Rename1() | ||
+ ~Goink() | ||
{ | ||
} | ||
|
||
// #TEST#: R8 =R5 Rename this class via typedef | ||
// #TEST#: R9 Rename typedef MyClass | ||
- typedef Rename1 MyClass; | ||
+ typedef Goink MyClass; | ||
|
||
// #TEST#: R10 Rename this method | ||
void Operation() | ||
@@ -616,11 +616,11 @@ void TestRename() | ||
|
||
// #TEST#: R191 Rename MyClass | ||
// #TEST#: R192 =R5 Rename Rename1 from scope qualifier | ||
- Rename1::MyClass myClass; | ||
+ Goink::MyClass myClass; | ||
myClass.Operation(); | ||
|
||
// #TEST#: R193 Rename this variable | ||
- Rename1 test; | ||
+ Goink test; | ||
// #TEST#: R194 Rename this method | ||
test.Operation(); | ||
// #TEST#: R195 Rename this function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 =R5 Rename this class via its c'tor | ||
- Rename1() : x() | ||
+ Goink() : x() | ||
{ | ||
} | ||
|
||
// #TEST#: R7 =R5 Rename this class via its d'tor | ||
- ~Rename1() | ||
+ ~Goink() | ||
{ | ||
} | ||
|
||
// #TEST#: R8 =R5 Rename this class via typedef | ||
// #TEST#: R9 Rename typedef MyClass | ||
- typedef Rename1 MyClass; | ||
+ typedef Goink MyClass; | ||
|
||
// #TEST#: R10 Rename this method | ||
void Operation() | ||
@@ -616,11 +616,11 @@ void TestRename() | ||
|
||
// #TEST#: R191 Rename MyClass | ||
// #TEST#: R192 =R5 Rename Rename1 from scope qualifier | ||
- Rename1::MyClass myClass; | ||
+ Goink::MyClass myClass; | ||
myClass.Operation(); | ||
|
||
// #TEST#: R193 Rename this variable | ||
- Rename1 test; | ||
+ Goink test; | ||
// #TEST#: R194 Rename this method | ||
test.Operation(); | ||
// #TEST#: R195 Rename this function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AWAITING TEST RESULTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AWAITING TEST RESULTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#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: | ||
// #TEST#: R7 Rename method | ||
int Operation1() | ||
{ | ||
return 1; | ||
} | ||
// #TEST#: R8 Rename method | ||
int Operation2() | ||
{ | ||
return 2; | ||
} | ||
}; | ||
|
||
// #TEST#: R5 Rename this class, but class in Rename2.cpp shouldn't be renamed | ||
class Rename1 | ||
{ | ||
public: | ||
// #TEST#: R6 =R5 Rename this class via its c'tor | ||
Rename1() : x() | ||
{ | ||
} | ||
|
||
~Rename1() | ||
{ | ||
} | ||
|
||
typedef Rename1 MyClass; | ||
|
||
void Operation() | ||
{ | ||
} | ||
|
||
int x; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 | ||
@@ -645,7 +645,7 @@ void TestRename() | ||
// #TEST#: R205 rename the variable Y::x | ||
int y = test2.Operation() + X::x + X::y + Y::x; | ||
|
||
- float x = MACRO_NO_ARGS; | ||
+ float x = GOINK; | ||
x = MACRO_ONE_ARG(2.0f); | ||
|
||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ |
Oops, something went wrong.