From baced5d10e8b48851443628d3e9150b2c0584cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 16 Jun 2021 22:50:32 +0200 Subject: [PATCH] Test for the --help option --- test/solc/CommandLineParser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/solc/CommandLineParser.cpp b/test/solc/CommandLineParser.cpp index a13fd0ccd..430399c5c 100644 --- a/test/solc/CommandLineParser.cpp +++ b/test/solc/CommandLineParser.cpp @@ -102,6 +102,17 @@ BOOST_AUTO_TEST_CASE(no_options) BOOST_TEST((parsedOptions.value() == expectedOptions)); } +BOOST_AUTO_TEST_CASE(help) +{ + stringstream sout, serr; + optional parsedOptions = parseCommandLine({"solc", "--help"}, sout, serr); + + BOOST_TEST(serr.str() == ""); + BOOST_TEST(boost::starts_with(sout.str(), "solc, the Solidity commandline compiler.")); + BOOST_TEST(sout.str().find("Usage: solc [options] [input_file...]") != string::npos); + BOOST_TEST(!parsedOptions.has_value()); +} + BOOST_AUTO_TEST_CASE(cli_mode_options) { for (InputMode inputMode: {InputMode::Compiler, InputMode::CompilerWithASTImport})