fixed import inside sources in InlineSourcesPacman

This commit is contained in:
sergeych committed 2025-07-04 02:23:45 +03:00
1 parent 868379ce22
commit 1e2cb5e420
9 files changed
+188 -83

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import junit.framework.TestCase.assertEquals
import kotlinx.coroutines.runBlocking
import net.sergeych.lyng.*
import kotlin.test.Test
class OtherTests {
@Test
fun testImports3() = runBlocking {
val foosrc = """
package lyng.foo
import lyng.bar
fun foo() { "foo1" }
""".trimIndent()
val barsrc = """
package lyng.bar
fun bar() { "bar1" }
""".trimIndent()
val pm = InlineSourcesPacman(
Pacman.emptyAllowAll, listOf(
Source("foosrc", foosrc),
Source("barsrc", barsrc),
))
val src = """
import lyng.foo
foo() + " / " + bar()
""".trimIndent().toSource("test")
val scope = ModuleScope(pm, src)
assertEquals("foo1 / bar1", scope.eval(src).toString())
}
}