From ef24aff534911d897f319f3984e87c5e8016607e Mon Sep 17 00:00:00 2001 From: Pavel Punegov <32519625+PavelPunegov@users.noreply.github.com> Date: Fri, 21 Jun 2019 15:59:35 +0300 Subject: [PATCH] Fix import packages in external tests --- .../main/groovy/org/jetbrains/kotlin/KonanTest.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 27291901b36..9cb998940f8 100644 --- a/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/build-tools/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -443,9 +443,12 @@ class RunExternalTestGroup extends OldKonanTest { } if (line.contains("$pkg.") && ! (line =~ packagePattern || line =~ importRegex) && ! vars.contains(pkg)) { - def idx = line.indexOf("$pkg") - if (! (idx > 0 && Character.isJavaIdentifierPart(line.charAt(idx - 1))) ) { - line = line.substring(0, idx) + "$sourceName.$pkg" + line.substring(idx + pkg.length()) + def idx = 0 + while ((idx = line.indexOf(pkg, idx)) >= 0) { + if (!Character.isJavaIdentifierPart(line.charAt(idx - 1))) { + line = line.substring(0, idx) + "$sourceName.$pkg" + line.substring(idx + pkg.length()) + idx += sourceName.length() + pkg.length() + 1 + } } } }