mirror of
https://github.com/github/codeql.git
synced 2026-05-29 18:41:27 +02:00
improve performance of getTestFile by finding possible test files first
This commit is contained in:
committed by
Jean Helie
parent
b6b93065ff
commit
531825d9a6
@@ -39,12 +39,14 @@ class BDDTest extends Test, @call_expr {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the test file for `f` with stem extension `stemExt`.
|
||||
* Gets the test file for `f` with stem extension `stemExt`, where `stemExt` is "test" or "spec".
|
||||
* That is, a file named file named `<base>.<stemExt>.<ext>` in the
|
||||
* same directory as `f` which is named `<base>.<ext>`.
|
||||
*/
|
||||
bindingset[stemExt]
|
||||
pragma[noinline]
|
||||
File getTestFile(File f, string stemExt) {
|
||||
stemExt = ["test", "spec"] and
|
||||
result.getBaseName().regexpMatch(".*\\.(test|spec)\\..*") and
|
||||
result = f.getParentContainer().getFile(f.getStem() + "." + stemExt + "." + f.getExtension())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user