fixed double imports bug
added clean import scope Scope.new()
This commit is contained in:
1 parent
230cb0a067
commit
9771b40c98
7 files changed
+102
-19
No files matched your search
@@ -2443,7 +2443,7 @@ class ScriptTest {
|
||||
|
||||
@Test
|
||||
fun testDefaultImportManager() = runTest {
|
||||
val scope = Scope()
|
||||
val scope = Scope.new()
|
||||
assertFails {
|
||||
scope.eval("""
|
||||
import foo
|
||||
@@ -2574,4 +2574,42 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDoubleImports() = runTest {
|
||||
val s = Scope.new()
|
||||
println(Script.defaultImportManager.packageNames)
|
||||
println(s.importManager.packageNames)
|
||||
|
||||
s.importManager.addTextPackages("""
|
||||
package foo
|
||||
|
||||
import lyng.time
|
||||
|
||||
fun foo() {
|
||||
println("foo: %s"(Instant()))
|
||||
}
|
||||
""".trimIndent())
|
||||
s.importManager.addTextPackages("""
|
||||
package bar
|
||||
|
||||
import lyng.time
|
||||
|
||||
fun bar() {
|
||||
println("bar: %s"(Instant()))
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
println(s.importManager.packageNames)
|
||||
|
||||
s.eval("""
|
||||
import foo
|
||||
import bar
|
||||
|
||||
foo()
|
||||
bar()
|
||||
|
||||
""".trimIndent())
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user