mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
InlineExpectationsTest: Add test showing what happens if you leave out getARelevantTag
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| test.py:4:1:4:3 | foo | Unexpected result: foo=val |
|
||||
@@ -0,0 +1,20 @@
|
||||
// test to illustrate what happens if you forget to put in the
|
||||
// right values for `getARelevantTag`. We want to alert on this,
|
||||
// so it gets fixed!
|
||||
import python
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class MissingRelevantTag extends InlineExpectationsTest {
|
||||
MissingRelevantTag() { this = "MissingRelevantTag" }
|
||||
|
||||
override string getARelevantTag() { none() }
|
||||
|
||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(Name name | name.getId() = "foo" |
|
||||
location = name.getLocation() and
|
||||
element = name.toString() and
|
||||
value = "val" and
|
||||
tag = "foo"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
foo # $ foo=val
|
||||
|
||||
# with wrong value
|
||||
foo # $ foo=bad-value
|
||||
|
||||
# there is a typo here, so this result is actually missing!
|
||||
fooo # $ foo=val
|
||||
Reference in New Issue
Block a user