Skip to content

Commit

Permalink
Added test for OptionParser::getEraseAfterParse()
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Apr 22, 2011
1 parent 2c0476e commit 3941c72
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/OptionParserTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class OptionParserTest:public CppUnit::TestFixture {
(new DefaultOptionHandler("alpha", NO_DESCRIPTION, "ALPHA", "",
OptionHandler::REQ_ARG, 'A'));
alpha->addTag("apple");
alpha->setEraseAfterParse(true);
oparser_->addOptionHandler(alpha);

SharedHandle<OptionHandler> bravo(new DefaultOptionHandler("bravo"));
Expand Down Expand Up @@ -162,8 +163,8 @@ void OptionParserTest::testParseArg()
char nonopt2[8];
strncpy(nonopt2, "nonopt2", sizeof(nonopt2));

char* const argv[] = { prog, optionAlpha, argAlpha, optionBravo, argBravo,
nonopt1, nonopt2 };
char* argv[] = { prog, optionAlpha, argAlpha, optionBravo, argBravo,
nonopt1, nonopt2 };
int argc = A2_ARRAY_LEN(argv);

std::stringstream s;
Expand All @@ -177,6 +178,8 @@ void OptionParserTest::testParseArg()
CPPUNIT_ASSERT_EQUAL((size_t)2, nonopts.size());
CPPUNIT_ASSERT_EQUAL(std::string("nonopt1"), nonopts[0]);
CPPUNIT_ASSERT_EQUAL(std::string("nonopt2"), nonopts[1]);

CPPUNIT_ASSERT_EQUAL(std::string("*****"), std::string(argAlpha));
}

void OptionParserTest::testParse()
Expand Down

0 comments on commit 3941c72

Please sign in to comment.