@@ -262,7 +262,6 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
262262 " --error-recovery" , // Ignored in assembly mode
263263 " --overwrite" ,
264264 " --evm-version=spuriousDragon" ,
265- " --experimental-via-ir" , // Ignored in assembly mode
266265 " --revert-strings=strip" , // Accepted but has no effect in assembly mode
267266 " --pretty-json" ,
268267 " --json-indent=1" ,
@@ -357,7 +356,6 @@ BOOST_AUTO_TEST_CASE(standard_json_mode_options)
357356 " --output-dir=/tmp/out" , // Accepted but has no effect in Standard JSON mode
358357 " --overwrite" , // Accepted but has no effect in Standard JSON mode
359358 " --evm-version=spuriousDragon" , // Ignored in Standard JSON mode
360- " --experimental-via-ir" , // Ignored in Standard JSON mode
361359 " --revert-strings=strip" , // Accepted but has no effect in Standard JSON mode
362360 " --pretty-json" ,
363361 " --json-indent=1" ,
@@ -422,6 +420,32 @@ BOOST_AUTO_TEST_CASE(standard_json_mode_options)
422420 BOOST_TEST (parsedOptions.value () == expectedOptions);
423421}
424422
423+ BOOST_AUTO_TEST_CASE (experimental_via_ir_invalid_input_modes)
424+ {
425+ static array<string, 5 > const inputModeOptions = {
426+ " --assemble" ,
427+ " --yul" ,
428+ " --strict-assembly" ,
429+ " --standard-json" ,
430+ " --link" ,
431+ };
432+ for (string const & inputModeOption: inputModeOptions)
433+ {
434+ stringstream sout, serr;
435+ vector<string> commandLine = {
436+ " solc" ,
437+ " --experimental-via-ir" ,
438+ " file" ,
439+ inputModeOption,
440+ };
441+ optional<CommandLineOptions> parsedOptions = parseCommandLine (commandLine, sout, serr);
442+
443+ BOOST_TEST (sout.str () == " " );
444+ BOOST_TEST (serr.str () == " The option --experimental-via-ir is only supported in the compiler mode.\n " );
445+ BOOST_REQUIRE (!parsedOptions.has_value ());
446+ }
447+ }
448+
425449BOOST_AUTO_TEST_SUITE_END ()
426450
427451} // namespace solidity::frontend::test
0 commit comments