From: Eric S. Raymond Date: Thu, 7 Apr 2022 10:42:20 +0000 (-0400) Subject: Improve test coverage. X-Git-Tag: 1.11~28 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=49e2479efadce8f678966fc21a6db40b9b2024ac Improve test coverage. --- diff --git a/actions.c b/actions.c index fe6daa1..fc85e0e 100644 --- a/actions.c +++ b/actions.c @@ -861,8 +861,10 @@ static phase_codes_t fly(verb_t verb, obj_t obj) game.newloc = LOC_CLIFF; rspeak(RUG_RETURNS); } else { +// LCOV_EXCL_START /* should never happen */ rspeak(NOTHING_HAPPENS); +// LCOV_EXCL_STOP } return GO_TERMINATE; } diff --git a/saveresume.c b/saveresume.c index fb247c9..2305077 100644 --- a/saveresume.c +++ b/saveresume.c @@ -107,7 +107,7 @@ int resume(void) while (fp == NULL) { char* name = myreadline("\nFile name: "); - // Autocomplete can leave the input with an extra traoling space. + // Autocomplete can leave the input with an extra trailing space. if (name != NULL && strlen(name) > 0 && name[strlen(name) - 1] == ' ') name[strlen(name) - 1] = '\0'; if (name == NULL) diff --git a/tests/Makefile b/tests/Makefile index 7256b19..a2892a7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -67,6 +67,7 @@ buildregress: savegames OPTS=`sed -n /#options:/s///p <$${file}.log`; \ advent $$OPTS <$${file}.log >$${file}.chk 2>&1 || exit 1; \ done; \ + echo "inven" | advent isofoo.log /dev/stdin >multifile.chk rm -f scratch.tmp savecheck: savegames @@ -96,17 +97,19 @@ regress: then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \ else echo "*** Nonzero return status on $${file}!"; exit 1; fi \ done; \ + $(ECHO) " multifile ## Test multiple file arguments" + @(echo "inven" | advent isofoo.log /dev/stdin | diff --text -u multifile.chk -) || exit 1 rm -f scratch.tmp /tmp/regress$$$$ # Steps towards TAP and parallelization. # There's a blocker in that the log tests can't be run concurrently -# due to isssues with colliding save files. +# due to issues with colliding save files. # The TAP filter. Only affects presentation of the test suite messages TAPCONSUMER=tappy # Fall back to safety if our declared TAP consumer does not exist. -# This is helpful in the CI environment, where it wiuld be better for +# This is helpful in the CI environment, where it would be better for # the logfiles to carry the raw TAP messages. TAPFILTER=$(shell command -v $(TAPCONSUMER) || echo cat) diff --git a/tests/multifile.chk b/tests/multifile.chk new file mode 100644 index 0000000..910fee2 --- /dev/null +++ b/tests/multifile.chk @@ -0,0 +1,27 @@ + +Welcome to Adventure!! Would you like instructions? + +> ## Test isolated 'foo' word +> n +> n + +You are standing at the end of a road before a small brick building. +Around you is a forest. A small stream flows out of the building and +down a gully. + +> foo +> foo + +Nothing happens. + +> inven +> inven + +You're not carrying anything. + + +You scored 32 out of a possible 430, using 2 turns. + +You are obviously a rank amateur. Better luck next time. + +To achieve the next higher rating, you need 14 more points. diff --git a/tests/saveresume.4.log b/tests/saveresume.4.log index a2d5901..caa8098 100644 --- a/tests/saveresume.4.log +++ b/tests/saveresume.4.log @@ -1,7 +1,8 @@ ## Resume, then win # Here to get class threshold of 426 +# Note, savefile name has trailing space n resume y -saveresume_win.adv -blast \ No newline at end of file +saveresume_win.adv +blast