Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

34 lines
827 B
Plaintext

# @TEST-EXEC: hiltic -j %INPUT >>output
# @TEST-EXEC: echo >>output
# @TEST-EXEC: hiltic -j -o a.hlto %INPUT && hiltic -j a.hlto >>output
# @TEST-EXEC: btest-diff output
#
# @TEST-DOC: Check that "preinit" and "init" functions are called in the expected order.
module Test {
import hilti;
init function void test_init() {
hilti::print("init");
}
init function void test_init2() {
hilti::print("init");
}
preinit function void test_preinit() {
# Calling runtime functionality isn't well-defined from
# inside a preinit function but this happens to work.
hilti::print("preinit");
}
preinit function void test_preinit2() {
# Calling runtime functionality isn't well-defined from
# inside a preinit function but this happens to work.
hilti::print("preinit");
}
hilti::print("module init");
}