Fixes to commands where (sub)commands never extend pkl:Command (#1882)
This commit is contained in:
1 parent
e83d8fa14b
commit
1271da2741
6 files changed
+185
-23
No files matched your search
@@ -1286,4 +1286,41 @@ class CliCommandRunnerTest {
|
||||
;;"""
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `exec of amended subcommand`() {
|
||||
writePklFile(
|
||||
"sub.pkl",
|
||||
"""
|
||||
extends "pkl:Command"
|
||||
target: String
|
||||
"""
|
||||
.trimIndent(),
|
||||
)
|
||||
val moduleUri =
|
||||
writePklFile(
|
||||
"cmd.pkl",
|
||||
"""
|
||||
amends "pkl:Command"
|
||||
import "sub.pkl"
|
||||
|
||||
command {
|
||||
name = "root"
|
||||
subcommands {
|
||||
new sub { target = "foo" }
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent(),
|
||||
)
|
||||
val output = runToStdout(CliBaseOptions(sourceModules = listOf(moduleUri)), listOf("sub"))
|
||||
assertThat(output)
|
||||
.isEqualTo(
|
||||
"""
|
||||
target = "foo"
|
||||
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user