1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Add config/parse tests for partial options.

Add coverage for partial options, i.e. an option that is partially specified but only prefix matches with a single valid option.
This commit is contained in:
David Steele 2021-05-13 16:54:25 -04:00
parent add0f9b77d
commit 2b8d2daca1

View File

@ -601,6 +601,15 @@ testRun(void)
configParse(storageTest, strLstSize(argList), strLstPtr(argList), false), CommandInvalidError,
"invalid command 'BOGUS:BOGUS'");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error on ambiguous partial option");
argList = strLstNew();
strLstAddZ(argList, TEST_BACKREST_EXE);
strLstAddZ(argList, "--c");
TEST_ERROR(
configParse(storageTest, strLstSize(argList), strLstPtr(argList), false), OptionInvalidError, "invalid option '--c'");
// -------------------------------------------------------------------------------------------------------------------------
argList = strLstNew();
strLstAdd(argList, strNew(TEST_BACKREST_EXE));
@ -760,7 +769,7 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, strNew(TEST_BACKREST_EXE));
strLstAdd(argList, strNew(TEST_COMMAND_BACKUP));
strLstAdd(argList, strNew("--stanza=db"));
strLstAdd(argList, strNew("--stanz=db")); // Partial option to test matching
strLstAdd(argList, strNew("--pg1-path=/path1//path2"));
TEST_ERROR(
configParse(storageTest, strLstSize(argList), strLstPtr(argList), false), OptionInvalidValueError,