Files
mgmt/lang/interpret_test/TestAstFunc2/slow-unification2.txtar
James Shubin 8fffd10280 lang: Port TestAstFunc2 to txtar format
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.
2023-06-01 16:56:44 -04:00

28 lines
749 B
Plaintext

-- main.mcl --
# reported by foxxx0
import "classes.mcl" as baz
include baz.foo("hello world")
include baz.foo("meep")
include baz.foo("foo")
-- classes.mcl --
import "datetime"
import "math"
class foo($bar) {
$now = datetime.now()
print "/tmp/some-module-${bar}" {
msg => if datetime.weekday($now) == "friday" { "TGIF YAY!" } else { "meh..." },
}
$x = math.mod($now, 2)
print "/tmp/some-module-${bar}-flipflop" {
msg => if $x == 0 { "FLIP" } else { "FLOP" },
}
}
-- OUTPUT --
Vertex: print[/tmp/some-module-foo-flipflop]
Vertex: print[/tmp/some-module-foo]
Vertex: print[/tmp/some-module-hello world-flipflop]
Vertex: print[/tmp/some-module-hello world]
Vertex: print[/tmp/some-module-meep-flipflop]
Vertex: print[/tmp/some-module-meep]