Since this special one_instance function uses global state, if it's re-used in more than one test, this won't work since they still all use the whole global state. Make new ones for each test. This also breaks the count=2 feature (any number other than 1) when running these, which is not ideal. Create a cleanup API that we can run between tests to reset the global state.
20 lines
408 B
Plaintext
20 lines
408 B
Plaintext
-- main.mcl --
|
|
import "test"
|
|
|
|
func double($x) {
|
|
$x + $x
|
|
}
|
|
|
|
# one_instance_c should only produce one value, and will error if initialized twice
|
|
test "test1" {
|
|
anotherstr => double(test.one_instance_c()),
|
|
}
|
|
|
|
# one_instance_d should only produce one value, and will error if initialized twice
|
|
test "test2" {
|
|
anotherstr => double(test.one_instance_d()),
|
|
}
|
|
-- OUTPUT --
|
|
Vertex: test[test1]
|
|
Vertex: test[test2]
|