Python tests: Move helper predicate into TestUtils.qll

This commit is contained in:
Mark Shannon
2019-01-23 11:20:04 +00:00
parent 5dd0123f0d
commit 0ea2d56945
4 changed files with 15 additions and 24 deletions

View File

@@ -22,3 +22,11 @@ string remove_prefix_before_substring(string str, string sub) {
string remove_library_prefix(Location loc) {
result = remove_prefix_before_substring(loc.toString(), "resources/lib")
}
/** Returns the location of an AST node in compact form: `basename:line:column` */
string compact_location(AstNode a) {
exists(Location l |
l = a.getLocation() |
result = l.getFile().getBaseName() + ":" + l.getStartLine() + ":" + l.getStartColumn()
)
}