Skip to content

Commit 76e84ef

Browse files
committed
InlineExpectationsTest: Fail if missing getARelevantTag
1 parent bfe9aa1 commit 76e84ef

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

python/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ abstract class InlineExpectationsTest extends string {
137137
final predicate hasFailureMessage(FailureLocatable element, string message) {
138138
exists(ActualResult actualResult |
139139
actualResult.getTest() = this and
140+
actualResult.getTag() = this.getARelevantTag() and
140141
element = actualResult and
141142
(
142143
exists(FalseNegativeExpectation falseNegative |
@@ -150,9 +151,18 @@ abstract class InlineExpectationsTest extends string {
150151
)
151152
)
152153
or
154+
exists(ActualResult actualResult |
155+
actualResult.getTest() = this and
156+
not actualResult.getTag() = this.getARelevantTag() and
157+
element = actualResult and
158+
message =
159+
"Tag mismatch: Actual result with tag " + actualResult.getTag() +
160+
" that is not part of getARelevantTag()"
161+
)
162+
or
153163
exists(ValidExpectation expectation |
154164
not exists(ActualResult actualResult | expectation.matchesActualResult(actualResult)) and
155-
expectation.getTag() = getARelevantTag() and
165+
expectation.getTag() = this.getARelevantTag() and
156166
element = expectation and
157167
(
158168
expectation instanceof GoodExpectation and
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
| test.py:4:1:4:3 | foo | Unexpected result: foo=val |
1+
| test.py:1:1:1:3 | foo | Tag mismatch: Actual result with tag foo that is not part of getARelevantTag() |
2+
| test.py:4:1:4:3 | foo | Tag mismatch: Actual result with tag foo that is not part of getARelevantTag() |

0 commit comments

Comments
 (0)