Skip to content

Commit baced5d

Browse files
committed
Test for the --help option
1 parent 4c479b5 commit baced5d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/solc/CommandLineParser.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ BOOST_AUTO_TEST_CASE(no_options)
102102
BOOST_TEST((parsedOptions.value() == expectedOptions));
103103
}
104104

105+
BOOST_AUTO_TEST_CASE(help)
106+
{
107+
stringstream sout, serr;
108+
optional<CommandLineOptions> parsedOptions = parseCommandLine({"solc", "--help"}, sout, serr);
109+
110+
BOOST_TEST(serr.str() == "");
111+
BOOST_TEST(boost::starts_with(sout.str(), "solc, the Solidity commandline compiler."));
112+
BOOST_TEST(sout.str().find("Usage: solc [options] [input_file...]") != string::npos);
113+
BOOST_TEST(!parsedOptions.has_value());
114+
}
115+
105116
BOOST_AUTO_TEST_CASE(cli_mode_options)
106117
{
107118
for (InputMode inputMode: {InputMode::Compiler, InputMode::CompilerWithASTImport})

0 commit comments

Comments
 (0)