Improve handling of evaling dependency notation URIs (#1595)

This commit is contained in:
Daniel Chao
2026-05-15 15:51:09 -07:00
committed by GitHub
parent 3ad1cb3645
commit a7a64acbac
17 changed files with 123 additions and 156 deletions
@@ -1754,6 +1754,32 @@ result = someLib.x
)
}
@Test
fun `eval dependency notation source`(@TempDir tempDir: Path) {
PackageServer.populateCacheDir(tempDir)
val projectPath =
FileTestUtils.rootProjectDir.resolve(
"pkl-commons-cli/src/main/resources/org/pkl/commons/cli/project1/"
)
val options =
CliEvaluatorOptions(
CliBaseOptions(
sourceModules = listOf(URI("@fruit/catalog/apple.pkl")),
projectDir = projectPath,
moduleCacheDir = tempDir,
)
)
val output = evalToConsole(options)
assertThat(output)
.isEqualTo(
"""
name = "Apple 🍎"
"""
.trimIndent()
)
}
private fun evalModuleThatImportsPackage(certsFile: Path?, testPort: Int = -1) {
val moduleUri =
writePklFile(