projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Test coverage: make LCOV ignore code unreachable without interactive shell
[open-adventure.git]
/
misc.c
diff --git
a/misc.c
b/misc.c
index 81f8e2b2bd4f0212d258495fb0bed42403a7501b..0b28f00a2411e4b1673e9836b604c9c24f22be31 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-252,7
+252,10
@@
char* get_input()
input = NULL;
size_t n = 0;
if (isatty(0))
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);
printf("%s", input_prompt);
+ // LCOV_EXCL_STOP
IGNORE(getline(&input, &n, stdin));
}
IGNORE(getline(&input, &n, stdin));
}
@@
-289,10
+292,13
@@
bool yes(const char* question, const char* yes_response, const char* no_response
speak(question);
reply = get_input();
speak(question);
reply = get_input();
- if (reply == NULL) {
- linenoiseFree(reply);
- exit(EXIT_SUCCESS);
- }
+ 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);
sscanf(reply, "%s", firstword);
char* firstword = (char*) xmalloc(strlen(reply)+1);
sscanf(reply, "%s", firstword);