From 865e10e6d0d15df04ac6209990394277ba1da2a7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 12 Apr 2022 11:27:07 -0400 Subject: [PATCH] Coverage fixups. --- Makefile | 2 ++ main.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 80ac01f..c44cce5 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,8 @@ cheat: $(CHEAT_OBJS) dungeon.o check: advent cheat cd tests; $(MAKE) --quiet +# After this, run your browser ob coverage/open-adventure/index.html +# to see coverage results. coverage: debug cd tests; $(MAKE) coverage --quiet diff --git a/main.c b/main.c index 61a82e2..dca022a 100644 --- a/main.c +++ b/main.c @@ -160,14 +160,14 @@ char *myreadline(const char *prompt) if (settings.scriptfp != NULL && feof(settings.scriptfp)) fclose(settings.scriptfp); if (strcmp(next, "-") == 0) - settings.scriptfp = stdin; + settings.scriptfp = stdin; // LCOV_EXCL_LINE else settings.scriptfp = fopen(next, "r"); } if (isatty(fileno(settings.scriptfp))) { - free(buf); - return readline(prompt); + free(buf); // LCOV_EXCL_LINE + return readline(prompt); // LCOV_EXCL_LINE } else { char *ln = fgets(buf, BUFSIZ-1, settings.scriptfp); if (ln != NULL) { @@ -255,6 +255,7 @@ static void checkhints(void) game.hintlc[hint] = 0; return; default: // LCOV_EXCL_LINE + // Should never hap[pen BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE } -- 2.31.1