Fix missleading error message

Unknown arg is treated is causing fatal
error in this case and hence not ignored.
This commit is contained in:
Martchus 2017-04-05 23:45:23 +02:00
parent 71231c29da
commit c30011fe09
2 changed files with 3 additions and 3 deletions

View File

@ -251,7 +251,7 @@ void ArgumentReader::read(ArgumentVector &args)
++index, ++argv, argDenotation = nullptr;
break;
case UnknownArgumentBehavior::Fail:
throw Failure("The specified argument \""s % *argv + "\" is unknown and will be ignored."s);
throw Failure(argsToString("The specified argument \"", *argv, "\" is unknown."));
}
}
} // if(!matchingArg)

View File

@ -169,7 +169,7 @@ void ArgumentParserTests::testParsing()
parser.parseArgs(6, argv3);
CPPUNIT_FAIL("Exception expected.");
} catch(const Failure &e) {
CPPUNIT_ASSERT(!strcmp(e.what(), "The specified argument \"album\" is unknown and will be ignored."));
CPPUNIT_ASSERT_EQUAL("The specified argument \"album\" is unknown."s, string(e.what()));
}
// warning about unknown argument
@ -272,7 +272,7 @@ void ArgumentParserTests::testParsing()
CPPUNIT_FAIL("Exception expected.");
} catch(const Failure &e) {
CPPUNIT_ASSERT(!qtConfigArgs.qtWidgetsGuiArg().isPresent());
CPPUNIT_ASSERT(!strcmp(e.what(), "The specified argument \"-f\" is unknown and will be ignored."));
CPPUNIT_ASSERT_EQUAL("The specified argument \"-f\" is unknown."s, string(e.what()));
}
// equation sign syntax