Coverage fixups.

This commit is contained in:
Eric S. Raymond 2022-04-12 11:27:07 -04:00
parent c5250b5f3f
commit 865e10e6d0
2 changed files with 6 additions and 3 deletions

View file

@ -64,6 +64,8 @@ cheat: $(CHEAT_OBJS) dungeon.o
check: advent cheat check: advent cheat
cd tests; $(MAKE) --quiet cd tests; $(MAKE) --quiet
# After this, run your browser ob coverage/open-adventure/index.html
# to see coverage results.
coverage: debug coverage: debug
cd tests; $(MAKE) coverage --quiet cd tests; $(MAKE) coverage --quiet

7
main.c
View file

@ -160,14 +160,14 @@ char *myreadline(const char *prompt)
if (settings.scriptfp != NULL && feof(settings.scriptfp)) if (settings.scriptfp != NULL && feof(settings.scriptfp))
fclose(settings.scriptfp); fclose(settings.scriptfp);
if (strcmp(next, "-") == 0) if (strcmp(next, "-") == 0)
settings.scriptfp = stdin; settings.scriptfp = stdin; // LCOV_EXCL_LINE
else else
settings.scriptfp = fopen(next, "r"); settings.scriptfp = fopen(next, "r");
} }
if (isatty(fileno(settings.scriptfp))) { if (isatty(fileno(settings.scriptfp))) {
free(buf); free(buf); // LCOV_EXCL_LINE
return readline(prompt); return readline(prompt); // LCOV_EXCL_LINE
} else { } else {
char *ln = fgets(buf, BUFSIZ-1, settings.scriptfp); char *ln = fgets(buf, BUFSIZ-1, settings.scriptfp);
if (ln != NULL) { if (ln != NULL) {
@ -255,6 +255,7 @@ static void checkhints(void)
game.hintlc[hint] = 0; game.hintlc[hint] = 0;
return; return;
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
// Should never hap[pen
BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
} }