1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Use THROW_ON_SYS_ERROR*() to improve code coverage.

There is only one instance in the core code where this helps. It is mostly helpful in the tests.

There is an argument to be made that only THROW_SYS_ERROR*() variants should be used in the core code to improve test coverage.  If so, that will be the subject of a future commit.
This commit is contained in:
David Steele
2019-04-29 18:36:57 -04:00
parent 683b096e18
commit 59234f249e
5 changed files with 14 additions and 15 deletions

View File

@ -378,8 +378,7 @@ testRun(void)
int stdoutSave = dup(STDOUT_FILENO);
String *stdoutFile = strNewFmt("%s/stdout.help", testPath());
if (freopen(strPtr(stdoutFile), "w", stdout) == NULL) // {uncoverable - does not fail}
THROW_SYS_ERROR(FileWriteError, "unable to reopen stdout"); // {uncoverable+}
THROW_ON_SYS_ERROR(freopen(strPtr(stdoutFile), "w", stdout) == NULL, FileWriteError, "unable to reopen stdout");
// Not in a test wrapper to avoid writing to stdout
cmdHelp();