InlineExpectationsTest: Fail if missing getARelevantTag

This commit is contained in:
Rasmus Wriedt Larsen
2022-10-26 18:12:24 +02:00
parent bfe9aa1225
commit 76e84ef63a
2 changed files with 13 additions and 2 deletions

View File

@@ -137,6 +137,7 @@ abstract class InlineExpectationsTest extends string {
final predicate hasFailureMessage(FailureLocatable element, string message) {
exists(ActualResult actualResult |
actualResult.getTest() = this and
actualResult.getTag() = this.getARelevantTag() and
element = actualResult and
(
exists(FalseNegativeExpectation falseNegative |
@@ -150,9 +151,18 @@ abstract class InlineExpectationsTest extends string {
)
)
or
exists(ActualResult actualResult |
actualResult.getTest() = this and
not actualResult.getTag() = this.getARelevantTag() and
element = actualResult and
message =
"Tag mismatch: Actual result with tag " + actualResult.getTag() +
" that is not part of getARelevantTag()"
)
or
exists(ValidExpectation expectation |
not exists(ActualResult actualResult | expectation.matchesActualResult(actualResult)) and
expectation.getTag() = getARelevantTag() and
expectation.getTag() = this.getARelevantTag() and
element = expectation and
(
expectation instanceof GoodExpectation and

View File

@@ -1 +1,2 @@
| test.py:4:1:4:3 | foo | Unexpected result: foo=val |
| test.py:1:1:1:3 | foo | Tag mismatch: Actual result with tag foo that is not part of getARelevantTag() |
| test.py:4:1:4:3 | foo | Tag mismatch: Actual result with tag foo that is not part of getARelevantTag() |