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.
@@ -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,
