Problem with Danni Willis' SImple unit tests.

This has got to be something stupid I’m doing but I can see what.

I’m running the inform7 .deb binary for wheezy on stretch eg, Gnome-inform7 - Inform (6.33/6L38) ,

When I try to compile the following minimal test case :

"test" by "Allison Edwards"

include Simple Unit Tests by Dannii Willis.

the blue room is a room.

I get the following error

I’ve only just started playing with inform 7 - the bug to write my own IF was reawaken at Christmas, so can someone show me where I’ve gone wrong. Is there something wrong with my environment?

I’m guessing you have an old version of the extension: the “consider” syntax has been deprecated for some time and was removed in version 6L02. Did you get it from the site?

I can’t remember where I downloaded it from but it is version number 130803. But if that is date code it predates 6L02 as far as I can tell.

The source code page here on inform7 also shows a line using the consider syntax and having the same version number. (And diff reports the downloaded file as identical the one I’m using )

What would the new syntax be - so I can patch it ? Or do people advise using alternate unit test frameworks - if so which?

I’m keen to have unit tests, I feel a bit well,naked without them .

Unfortunately I don’t think that one’s been updated for the new version of Inform. Up-to-date extensions can usually be found on the Public Library (in the Extensions tab of the IDE) or the Github repo, the site has pre-6L02 ones.

The new syntax is “follow…” instead of “consider…”; they used to be slightly different, then the difference was removed, then “consider” was deprecated. But there might be more problems as well.

Nope, it’s the same in the Gitrepo hub too , AFAICT.

I’ll try patching it here and see what happens. Infact now you pointed me to 6L02 release notes it says:

I’ll report back on how I get on.

I’m bemused though - does this mean I’m the only one to have tried unittests since 2014 !! Seriously!

Well that is bizzarre. It didn’t work.

The report page says (edited for brevity)

and the I6 compilers output was odd - no reall error message at all
(also editted to add line wrapping)

I’ve tried compiling to z-code as well but there wasn’t anything in-essence different.

Any recommendations an alternate unittesting frameworks…

Interesting. I’ve found the problem, I think: the way rulebooks are stored has changed slightly in 6L02. It seems like there should be a way to access a numbered rule in a rulebook but I can’t find any way to do it within Rulebooks.i6t. Someone more familiar with the rulebook internals?

That’s no longer possible. Rulebooks used to be stored as arrays of rule addresses, but now they’re functions which invoke the rules in order. (This is faster.)

This is a separate problem which has been reported occasionally for Linux – the error output of the I6 compiler gets cut off. My guess is that the code to fork a subprocess and get its output is slightly wrong, but I’ve never looked at it.

I suppose this is technically a documentation bug. Output.i6t claims that “a rulebook is only a (word) array of rule addresses, terminated with a |NULL|.” But indeed, in auto.inf the rulebooks are long routines.

In other words, fixing that crash is going to require a longer and far more extensive rewrite of the extension than I had planned. I’ll look at it again later but for now you seem to be out of luck. :confused:

Looking at the source code I’m not sure it handles G_IO_STATUS_AGAIN correctly. Since you’ll be (Probably) be receiving SIGCHILD towards the end of output as well it a likely candidate. If I can get a compile env running I’ll try the obvious / usual E_AGAIN behaviour.

However, it does mean I can run the i6 compiler on the console to get the error.

Which seems to be included in line 46 of the extension itself in a I6 include block. Ho Him .

Thanks for you really quick help guys…

I think you just want to replace INDEXED_TEXT_TY_Say() calls with TEXT_TY_Say() for 6L02+.

You can do that but you’ll get a “memory access out of range” error when you try to run the unit tests. The extension tries to iterate through a rulebook as an array to get the list of tests, and that no longer works.

Yeah, it’s probably no longer possible to run unit tests these ways. I’m not sure what the most informative alternative would be. For these reasons it’s probably best to leave my Simple Unit Tests as a 6G60 extension, and for someone to write a new one for newer releases of I7.