A very simple IF regression test script

In my last HL update, I mentioned that I was writing unit tests. This is the script that I whipped up:

eblong.com/zarf/plotex/regtest.html

This is similar in concept to I7’s skein – you specify a list of commands and then check the output to make sure it’s what you want. However:

  • Works with any stdin/stdout IF interpreter.
  • The test script is a plain text file.
  • Easy to execute one test, a set of tests, or all tests from the command line.
  • The output-checking is conservative: you list key phrases to check for, and the script ignores the rest of the output. This works better (for me) for a game in development. For example, you can add objects to a room without causing a test failure on every “look” command.
  • You can also specify negative checks (make sure this phrase does not occur in the output of the command), and regular-expression checks for the fancy cases.