Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,29 @@ result = someLib.x
assertThat(buffer.toString()).isEqualTo("new Dynamic { friend { name = \"Bilbo\" } }")
}

@Test
fun `evaluate output expression - nested structure to JSON`() {
val moduleUri =
writePklFile(
"test.pkl",
"""
person {
friend { name = "Bilbo" }
}
"""
.trimIndent(),
)
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
expression = "person",
outputFormat = "json",
)
val buffer = StringWriter()
CliEvaluator(options, consoleWriter = buffer).run()
assertThat(buffer.toString()).isEqualTo("{ \"friend\": { \"name\": \"Bilbo\" } }")
}

@Test
fun `skip PklProject file`() {
val moduleUri =
Expand Down