Fix external tests: proper handle variables with getters and check vars in all files
This commit is contained in:
committed by
Pavel Punegov
parent
13cf470e33
commit
45e79846f9
@@ -265,6 +265,7 @@ class RunExternalTestGroup extends JavaExec {
|
|||||||
def packages = new LinkedHashSet<String>()
|
def packages = new LinkedHashSet<String>()
|
||||||
def imports = []
|
def imports = []
|
||||||
def classes = []
|
def classes = []
|
||||||
|
def vars = new HashSet<String>() // variables that has the same name as a package
|
||||||
TestModule mainModule = null
|
TestModule mainModule = null
|
||||||
|
|
||||||
def testFiles = TestDirectivesKt.buildCompileList(project.file("build/$src").toPath(), "$outputDirectory/$src")
|
def testFiles = TestDirectivesKt.buildCompileList(project.file("build/$src").toPath(), "$outputDirectory/$src")
|
||||||
@@ -335,11 +336,10 @@ class RunExternalTestGroup extends JavaExec {
|
|||||||
}
|
}
|
||||||
// now replace all package usages in full qualified names
|
// now replace all package usages in full qualified names
|
||||||
def res = "" // filesToCompile
|
def res = "" // filesToCompile
|
||||||
def vars = new HashSet<String>() // variables that has the same name as a package
|
|
||||||
text.eachLine { line ->
|
text.eachLine { line ->
|
||||||
packages.each { pkg ->
|
packages.each { pkg ->
|
||||||
// line contains val or var declaration or function parameter declaration
|
// line contains val or var declaration or function parameter declaration
|
||||||
if ((line =~ ~/va(l|r) *$pkg *\=/) || (line =~ ~/fun .*\(\n?\s*$pkg:.*/)) {
|
if ((line =~ ~/va(l|r) *$pkg *(get\(\))? *\=/) || (line =~ ~/fun .*\(\n?\s*$pkg:.*/)) {
|
||||||
vars.add(pkg)
|
vars.add(pkg)
|
||||||
}
|
}
|
||||||
if (line.contains("$pkg.") && !(line =~ packagePattern || line =~ importRegex)
|
if (line.contains("$pkg.") && !(line =~ packagePattern || line =~ importRegex)
|
||||||
|
|||||||
Reference in New Issue
Block a user