Test coverage: make LCOV ignore code unreachable without interactive shell

This commit is contained in:
Aaron Traas 2017-06-28 12:25:59 -04:00 committed by Eric S. Raymond
parent 6521d49c07
commit 60847652aa

6
misc.c
View file

@ -252,7 +252,10 @@ char* get_input()
input = NULL;
size_t n = 0;
if (isatty(0))
// LCOV_EXCL_START
// Should be unreachable in tests, as they will use a non-interactive shell.
printf("%s", input_prompt);
// LCOV_EXCL_STOP
IGNORE(getline(&input, &n, stdin));
}
@ -290,8 +293,11 @@ bool yes(const char* question, const char* yes_response, const char* no_response
reply = get_input();
if (reply == NULL) {
// LCOV_EXCL_START
// Should be unreachable. Reply should never be NULL
linenoiseFree(reply);
exit(EXIT_SUCCESS);
// LCOV_EXCL_STOP
}
char* firstword = (char*) xmalloc(strlen(reply)+1);