@@ -281,20 +281,6 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
281
281
" --libraries="
282
282
" dir1/file1.sol:L=0x1234567890123456789012345678901234567890,"
283
283
" dir2/file2.sol:L=0x1111122222333334444455555666667777788888" ,
284
- " --metadata-hash=swarm" , // Ignored in assembly mode
285
- " --metadata-literal" , // Ignored in assembly mode
286
- " --model-checker-contracts=" // Ignored in assembly mode
287
- " contract1.yul:A,"
288
- " contract2.yul:B" ,
289
- " --model-checker-div-mod-no-slacks" , // Ignored in assembly mode
290
- " --model-checker-engine=bmc" , // Ignored in assembly mode
291
- " --model-checker-invariants=contract,reentrancy" , // Ignored in assembly mode
292
- " --model-checker-show-unproved" , // Ignored in assembly mode
293
- " --model-checker-solvers=z3,smtlib2" , // Ignored in assembly mode
294
- " --model-checker-targets=" // Ignored in assembly mode
295
- " underflow,"
296
- " divByZero" ,
297
- " --model-checker-timeout=5" , // Ignored in assembly mode
298
284
" --asm" ,
299
285
" --bin" ,
300
286
" --ir-optimized" ,
@@ -378,20 +364,6 @@ BOOST_AUTO_TEST_CASE(standard_json_mode_options)
378
364
" dir2/file2.sol:L=0x1111122222333334444455555666667777788888" ,
379
365
" --gas" , // Accepted but has no effect in Standard JSON mode
380
366
" --combined-json=abi,bin" , // Accepted but has no effect in Standard JSON mode
381
- " --metadata-hash=swarm" , // Ignored in Standard JSON mode
382
- " --metadata-literal" , // Ignored in Standard JSON mode
383
- " --model-checker-contracts=" // Ignored in Standard JSON mode
384
- " contract1.yul:A,"
385
- " contract2.yul:B" ,
386
- " --model-checker-div-mod-no-slacks" , // Ignored in Standard JSON mode
387
- " --model-checker-engine=bmc" , // Ignored in Standard JSON mode
388
- " --model-checker-invariants=contract,reentrancy" , // Ignored in Standard JSON mode
389
- " --model-checker-show-unproved" , // Ignored in Standard JSON mode
390
- " --model-checker-solvers=z3,smtlib2" , // Ignored in Standard JSON mode
391
- " --model-checker-targets=" // Ignored in Standard JSON mode
392
- " underflow,"
393
- " divByZero" ,
394
- " --model-checker-timeout=5" , // Ignored in Standard JSON mode
395
367
};
396
368
397
369
CommandLineOptions expectedOptions;
@@ -424,16 +396,30 @@ BOOST_AUTO_TEST_CASE(invalid_options_input_modes_combinations)
424
396
// TODO: This should eventually contain all options.
425
397
{" --error-recovery" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
426
398
{" --experimental-via-ir" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
427
- {" --via-ir" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }}
399
+ {" --via-ir" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
400
+ {" --metadata-literal" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
401
+ {" --metadata-hash=swarm" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
402
+ {" --model-checker-show-unproved" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
403
+ {" --model-checker-div-mod-no-slacks" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
404
+ {" --model-checker-engine=bmc" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
405
+ {" --model-checker-invariants=contract,reentrancy" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
406
+ {" --model-checker-solvers=z3,smtlib2" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
407
+ {" --model-checker-timeout=5" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
408
+ {" --model-checker-contracts=contract1.yul:A,contract2.yul:B" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }},
409
+ {" --model-checker-targets=underflow,divByZero" , {" --assemble" , " --yul" , " --strict-assembly" , " --standard-json" , " --link" }}
428
410
};
429
411
430
412
for (auto const & [optionName, inputModes]: invalidOptionInputModeCombinations)
431
413
for (string const & inputMode: inputModes)
432
414
{
433
415
stringstream serr;
416
+ size_t separatorPosition = optionName.find (" =" );
417
+ string optionNameWithoutValue = optionName.substr (0 , separatorPosition);
418
+ soltestAssert (!optionNameWithoutValue.empty ());
419
+
434
420
vector<string> commandLine = {" solc" , optionName, " file" , inputMode};
435
421
436
- string expectedMessage = " The following options are not supported in the current input mode: " + optionName ;
422
+ string expectedMessage = " The following options are not supported in the current input mode: " + optionNameWithoutValue ;
437
423
auto hasCorrectMessage = [&](CommandLineValidationError const & _exception) { return _exception.what () == expectedMessage; };
438
424
439
425
BOOST_CHECK_EXCEPTION (parseCommandLine (commandLine), CommandLineValidationError, hasCorrectMessage);
0 commit comments