I like the “test” command. I was wondering if there was a way to do an assertion inside of a test, and halt with an error if it fails. Specifically I would like to do something like:
test me with "go north / wear the socks / assert the player is wearing the socks / go east / assert the player is in the northeastern room"
…and have the interpreter halt and report which if any assertion failed. Does Inform7 currently have this capability?
The only way to stop the test command is to force the game to quit.
You’d then write assertion rules like this:
Start room is a room. Northern room is north of start room. Northeastern room is east of northern room.
The socks are in northern room. Socks are plural-named and wearable.
Instead of taking the socks:
say "This makes the test fail."
Carry out unit testing "socks":
whether or not the player is wearing the socks confirms "the player is wearing socks".
Carry out unit testing "northeastern room":
whether or not the player is in northeastern room confirms "the player is in the northeastern room".
Test me with "go north / wear the socks / unittest socks / go east / unittest northeastern room".