Skip to content

Commit bfe9aa1

Browse files
committed
InlineExpectationsTest: Add test showing what happens if you leave out getARelevantTag
1 parent 3d025ea commit bfe9aa1

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test.py:4:1:4:3 | foo | Unexpected result: foo=val |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// test to illustrate what happens if you forget to put in the
2+
// right values for `getARelevantTag`. We want to alert on this,
3+
// so it gets fixed!
4+
import python
5+
import TestUtilities.InlineExpectationsTest
6+
7+
class MissingRelevantTag extends InlineExpectationsTest {
8+
MissingRelevantTag() { this = "MissingRelevantTag" }
9+
10+
override string getARelevantTag() { none() }
11+
12+
override predicate hasActualResult(Location location, string element, string tag, string value) {
13+
exists(Name name | name.getId() = "foo" |
14+
location = name.getLocation() and
15+
element = name.toString() and
16+
value = "val" and
17+
tag = "foo"
18+
)
19+
}
20+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
foo # $ foo=val
2+
3+
# with wrong value
4+
foo # $ foo=bad-value
5+
6+
# there is a typo here, so this result is actually missing!
7+
fooo # $ foo=val

0 commit comments

Comments
 (0)