This ports TestAstFunc2 from our home-grown content storage system to the txtar package. Since a single file can be used to represent the entire folder hierarchy, this makes it much easier to see and edit tests.
32 lines
371 B
Plaintext
32 lines
371 B
Plaintext
-- main.mcl --
|
|
# out of order
|
|
$out1 = $fn(true)
|
|
$some_bool = false
|
|
$fn = if $some_bool {
|
|
$funcgen()
|
|
} else {
|
|
func($bb) {
|
|
if $bb {
|
|
"so true"
|
|
} else {
|
|
"so false"
|
|
}
|
|
}
|
|
}
|
|
$out2 = $fn(false)
|
|
$funcgen = func() {
|
|
func($b) {
|
|
if $b {
|
|
"hello"
|
|
} else {
|
|
"world"
|
|
}
|
|
}
|
|
}
|
|
|
|
test $out1 {}
|
|
test $out2 {}
|
|
-- OUTPUT --
|
|
Vertex: test[so true]
|
|
Vertex: test[so false]
|