Is there a unit test library somewhere for Inform 6?
If not, no problem, I can write one myself for my own needs! But I wouldn’t say no for some advice.
I’m thinking of something a bit like Python’s unittest with a UnitTest
class that has assert methods. You could then write:
UnitTest "Unit test example"
with
test [;
self.assert_equal(1 + 1, 2);
self.assert_greaterthan(3, 2);
]
;
And you would loop over the UnitTest objects and execute their test
method. You could also add a before
and after
methods that are run before and after each test. (You could subclass UnitTest for that). We could also maybe group unit tests in a parent to have group-wide before
s and after
s.
It would be great to allow arbitrary-named methods (like test_A
, test_B
) and run every one that starts with “test”, but I don’ think Inform 6 has this level of introspection.
Any thoughts?