lang: funcs: core: test: Make a new instance for each test
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.
This commit is contained in:
@@ -10,11 +10,11 @@ class use_twice($test1, $test2, $x) {
|
||||
}
|
||||
}
|
||||
|
||||
# one_instance_a should only produce one value, and will error if initialized twice
|
||||
include use_twice("test1", "test2", test.one_instance_a())
|
||||
# one_instance_e should only produce one value, and will error if initialized twice
|
||||
include use_twice("test1", "test2", test.one_instance_e())
|
||||
|
||||
# one_instance_b should only produce one value, and will error if initialized twice
|
||||
include use_twice("test3", "test4", test.one_instance_b())
|
||||
# one_instance_f should only produce one value, and will error if initialized twice
|
||||
include use_twice("test3", "test4", test.one_instance_f())
|
||||
-- OUTPUT --
|
||||
Vertex: test[test1]
|
||||
Vertex: test[test2]
|
||||
|
||||
Reference in New Issue
Block a user