From 7a1b6fca25440ac6a670099d0773b2b382f39a25 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 2279fce92d13..fffbeab2aa6f 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})