Test-sets
testset
provides another scoped environment that can be used within a testenv
. A testset is also given a name and test statistics are printed out separately for each testset inside a test environment. For example,
evaluates to stdout
Test Environment: first test environementtestset: my first testset1/1 tests passedtestset: my second testset1/1 tests passed
Both testset blocks reuse the Lua variable z
and Terra variable x
defined earlier in the testenv
. Additionally, each testset introduces its own variables—y
in the first and p
in the second—which are scoped locally and accessible only within their respective testset.
Important
Testset environments are isolated from one another. For example, if x
were modified in the first testset, that change would not affect the second. This isolation ensures hygienic scoping, preventing unintended interference between testsets.