Skip to content

Commit 058a04f

Browse files
authored
Merge pull request #6795 from owen-mc/inline-expectation-test-trivial-change
Change class name in InlineExpectationTest to avoid clash
2 parents c75e2d3 + 938d003 commit 058a04f

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

cpp/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (in that the `.expected` file should always be empty).
55
*
66
* To add this framework to a new language:
7-
* - Add a file `InlineExpectationsTestPrivate.qll` that defines a `LineComment` class. This class
7+
* - Add a file `InlineExpectationsTestPrivate.qll` that defines a `ExpectationComment` class. This class
88
* must support a `getContents` method that returns the contents of the given comment, _excluding_
99
* the comment indicator itself. It should also define `toString` and `getLocation` as usual.
1010
*
@@ -60,8 +60,8 @@
6060
*
6161
* Example:
6262
* ```cpp
63-
* int i = x + 5; // $const=5
64-
* int j = y + (7 - 3) // $const=7 const=3 const=4 // The result of the subtraction is a constant.
63+
* int i = x + 5; // $ const=5
64+
* int j = y + (7 - 3) // $ const=7 const=3 const=4 // The result of the subtraction is a constant.
6565
* ```
6666
*
6767
* For tests that contain known missing and spurious results, it is possible to further
@@ -194,7 +194,7 @@ private int getEndOfColumnPosition(int start, string content) {
194194
}
195195

196196
private predicate getAnExpectation(
197-
LineComment comment, TColumn column, string expectation, string tags, string value
197+
ExpectationComment comment, TColumn column, string expectation, string tags, string value
198198
) {
199199
exists(string content |
200200
content = comment.getContents().regexpCapture(expectationCommentPattern(), 1) and
@@ -247,14 +247,14 @@ private newtype TFailureLocatable =
247247
) {
248248
test.hasActualResult(location, element, tag, value)
249249
} or
250-
TValidExpectation(LineComment comment, string tag, string value, string knownFailure) {
250+
TValidExpectation(ExpectationComment comment, string tag, string value, string knownFailure) {
251251
exists(TColumn column, string tags |
252252
getAnExpectation(comment, column, _, tags, value) and
253253
tag = tags.splitAt(",") and
254254
knownFailure = getColumnString(column)
255255
)
256256
} or
257-
TInvalidExpectation(LineComment comment, string expectation) {
257+
TInvalidExpectation(ExpectationComment comment, string expectation) {
258258
getAnExpectation(comment, _, expectation, _, _) and
259259
not expectation.regexpMatch(expectationPattern())
260260
}
@@ -292,7 +292,7 @@ class ActualResult extends FailureLocatable, TActualResult {
292292
}
293293

294294
abstract private class Expectation extends FailureLocatable {
295-
LineComment comment;
295+
ExpectationComment comment;
296296

297297
override string toString() { result = comment.toString() }
298298

cpp/ql/test/TestUtilities/InlineExpectationsTestPrivate.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import cpp
22

3-
private newtype TLineComment = MkLineComment(CppStyleComment c)
3+
private newtype TExpectationComment = MkExpectationComment(CppStyleComment c)
44

55
/**
66
* Represents a line comment in the CPP style.
77
* Unlike the `CppStyleComment` class, however, the string returned by `getContents` does _not_
88
* include the preceding comment marker (`//`).
99
*/
10-
class LineComment extends TLineComment {
10+
class ExpectationComment extends TExpectationComment {
1111
CppStyleComment comment;
1212

13-
LineComment() { this = MkLineComment(comment) }
13+
ExpectationComment() { this = MkExpectationComment(comment) }
1414

1515
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
1616
string getContents() { result = comment.getContents().suffix(2) }

java/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (in that the `.expected` file should always be empty).
55
*
66
* To add this framework to a new language:
7-
* - Add a file `InlineExpectationsTestPrivate.qll` that defines a `LineComment` class. This class
7+
* - Add a file `InlineExpectationsTestPrivate.qll` that defines a `ExpectationComment` class. This class
88
* must support a `getContents` method that returns the contents of the given comment, _excluding_
99
* the comment indicator itself. It should also define `toString` and `getLocation` as usual.
1010
*
@@ -60,8 +60,8 @@
6060
*
6161
* Example:
6262
* ```cpp
63-
* int i = x + 5; // $const=5
64-
* int j = y + (7 - 3) // $const=7 const=3 const=4 // The result of the subtraction is a constant.
63+
* int i = x + 5; // $ const=5
64+
* int j = y + (7 - 3) // $ const=7 const=3 const=4 // The result of the subtraction is a constant.
6565
* ```
6666
*
6767
* For tests that contain known missing and spurious results, it is possible to further
@@ -194,7 +194,7 @@ private int getEndOfColumnPosition(int start, string content) {
194194
}
195195

196196
private predicate getAnExpectation(
197-
LineComment comment, TColumn column, string expectation, string tags, string value
197+
ExpectationComment comment, TColumn column, string expectation, string tags, string value
198198
) {
199199
exists(string content |
200200
content = comment.getContents().regexpCapture(expectationCommentPattern(), 1) and
@@ -247,14 +247,14 @@ private newtype TFailureLocatable =
247247
) {
248248
test.hasActualResult(location, element, tag, value)
249249
} or
250-
TValidExpectation(LineComment comment, string tag, string value, string knownFailure) {
250+
TValidExpectation(ExpectationComment comment, string tag, string value, string knownFailure) {
251251
exists(TColumn column, string tags |
252252
getAnExpectation(comment, column, _, tags, value) and
253253
tag = tags.splitAt(",") and
254254
knownFailure = getColumnString(column)
255255
)
256256
} or
257-
TInvalidExpectation(LineComment comment, string expectation) {
257+
TInvalidExpectation(ExpectationComment comment, string expectation) {
258258
getAnExpectation(comment, _, expectation, _, _) and
259259
not expectation.regexpMatch(expectationPattern())
260260
}
@@ -292,7 +292,7 @@ class ActualResult extends FailureLocatable, TActualResult {
292292
}
293293

294294
abstract private class Expectation extends FailureLocatable {
295-
LineComment comment;
295+
ExpectationComment comment;
296296

297297
override string toString() { result = comment.toString() }
298298

java/ql/test/TestUtilities/InlineExpectationsTestPrivate.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import java
44
* A class representing line comments in Java, which is simply Javadoc restricted
55
* to EOL comments, with an extra accessor used by the InlineExpectations core code
66
*/
7-
class LineComment extends Javadoc {
8-
LineComment() { isEolComment(this) }
7+
class ExpectationComment extends Javadoc {
8+
ExpectationComment() { isEolComment(this) }
99

1010
/** Gets the contents of the given comment, _without_ the preceding comment marker (`//`). */
1111
string getContents() { result = this.getChild(0).toString() }

python/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (in that the `.expected` file should always be empty).
55
*
66
* To add this framework to a new language:
7-
* - Add a file `InlineExpectationsTestPrivate.qll` that defines a `LineComment` class. This class
7+
* - Add a file `InlineExpectationsTestPrivate.qll` that defines a `ExpectationComment` class. This class
88
* must support a `getContents` method that returns the contents of the given comment, _excluding_
99
* the comment indicator itself. It should also define `toString` and `getLocation` as usual.
1010
*
@@ -60,8 +60,8 @@
6060
*
6161
* Example:
6262
* ```cpp
63-
* int i = x + 5; // $const=5
64-
* int j = y + (7 - 3) // $const=7 const=3 const=4 // The result of the subtraction is a constant.
63+
* int i = x + 5; // $ const=5
64+
* int j = y + (7 - 3) // $ const=7 const=3 const=4 // The result of the subtraction is a constant.
6565
* ```
6666
*
6767
* For tests that contain known missing and spurious results, it is possible to further
@@ -194,7 +194,7 @@ private int getEndOfColumnPosition(int start, string content) {
194194
}
195195

196196
private predicate getAnExpectation(
197-
LineComment comment, TColumn column, string expectation, string tags, string value
197+
ExpectationComment comment, TColumn column, string expectation, string tags, string value
198198
) {
199199
exists(string content |
200200
content = comment.getContents().regexpCapture(expectationCommentPattern(), 1) and
@@ -247,14 +247,14 @@ private newtype TFailureLocatable =
247247
) {
248248
test.hasActualResult(location, element, tag, value)
249249
} or
250-
TValidExpectation(LineComment comment, string tag, string value, string knownFailure) {
250+
TValidExpectation(ExpectationComment comment, string tag, string value, string knownFailure) {
251251
exists(TColumn column, string tags |
252252
getAnExpectation(comment, column, _, tags, value) and
253253
tag = tags.splitAt(",") and
254254
knownFailure = getColumnString(column)
255255
)
256256
} or
257-
TInvalidExpectation(LineComment comment, string expectation) {
257+
TInvalidExpectation(ExpectationComment comment, string expectation) {
258258
getAnExpectation(comment, _, expectation, _, _) and
259259
not expectation.regexpMatch(expectationPattern())
260260
}
@@ -292,7 +292,7 @@ class ActualResult extends FailureLocatable, TActualResult {
292292
}
293293

294294
abstract private class Expectation extends FailureLocatable {
295-
LineComment comment;
295+
ExpectationComment comment;
296296

297297
override string toString() { result = comment.toString() }
298298

python/ql/test/TestUtilities/InlineExpectationsTestPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ import python
44
* A class representing line comments in Python. As this is the only form of comment Python
55
* permits, we simply reuse the `Comment` class.
66
*/
7-
class LineComment = Comment;
7+
class ExpectationComment = Comment;

0 commit comments

Comments
 (0)