Merge pull request #782 from markshannon/python-add-more-tests

Python: Add more tests
This commit is contained in:
Taus
2019-01-23 14:04:23 +01:00
committed by GitHub
28 changed files with 4513 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ string message() {
}
predicate exec_function_call(Call c) {
major_version() = 3 and exists(GlobalVariable exec | exec = ((Name)c.getFunc()).getVariable() and exec.getId() = "exec")
exists(GlobalVariable exec | exec = ((Name)c.getFunc()).getVariable() and exec.getId() = "exec")
}
from AstNode exec

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()
)
}