mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
prepare_report.py: Don't use --metadata option with compiler versions that do not support it
- Before 0.4.3 the option was unavailable but ignored. - Between 0.4.3 and 0.4.6 an attempt to use that option causes an error.
This commit is contained in:
@@ -176,6 +176,7 @@ class TestPrepareCompilerInput(PrepareReportTestBase):
|
||||
force_no_optimize_yul=False,
|
||||
interface=CompilerInterface.STANDARD_JSON,
|
||||
smt_use=SMTUse.DISABLE,
|
||||
metadata_option_supported=True,
|
||||
)
|
||||
|
||||
self.assertEqual(command_line, ['solc', '--standard-json'])
|
||||
@@ -189,6 +190,7 @@ class TestPrepareCompilerInput(PrepareReportTestBase):
|
||||
force_no_optimize_yul=False,
|
||||
interface=CompilerInterface.CLI,
|
||||
smt_use=SMTUse.DISABLE,
|
||||
metadata_option_supported=True,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
@@ -223,6 +225,7 @@ class TestPrepareCompilerInput(PrepareReportTestBase):
|
||||
force_no_optimize_yul=False,
|
||||
interface=CompilerInterface.STANDARD_JSON,
|
||||
smt_use=SMTUse.DISABLE,
|
||||
metadata_option_supported=True,
|
||||
)
|
||||
|
||||
self.assertEqual(command_line, ['solc', '--standard-json'])
|
||||
@@ -236,6 +239,7 @@ class TestPrepareCompilerInput(PrepareReportTestBase):
|
||||
force_no_optimize_yul=True,
|
||||
interface=CompilerInterface.CLI,
|
||||
smt_use=SMTUse.DISABLE,
|
||||
metadata_option_supported=True,
|
||||
)
|
||||
|
||||
self.assertEqual(compiler_input, SMT_CONTRACT_WITH_MIXED_NEWLINES_SOL_CODE)
|
||||
@@ -248,6 +252,7 @@ class TestPrepareCompilerInput(PrepareReportTestBase):
|
||||
force_no_optimize_yul=True,
|
||||
interface=CompilerInterface.CLI,
|
||||
smt_use=SMTUse.DISABLE,
|
||||
metadata_option_supported=True,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
@@ -256,6 +261,23 @@ class TestPrepareCompilerInput(PrepareReportTestBase):
|
||||
)
|
||||
self.assertEqual(compiler_input, SMT_SMOKE_TEST_SOL_CODE)
|
||||
|
||||
def test_prepare_compiler_input_for_cli_should_not_use_metadata_option_if_not_supported(self):
|
||||
(command_line, compiler_input) = prepare_compiler_input(
|
||||
Path('solc'),
|
||||
SMT_SMOKE_TEST_SOL_PATH,
|
||||
optimize=True,
|
||||
force_no_optimize_yul=False,
|
||||
interface=CompilerInterface.CLI,
|
||||
smt_use=SMTUse.PRESERVE,
|
||||
metadata_option_supported=False,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
command_line,
|
||||
['solc', str(SMT_SMOKE_TEST_SOL_PATH), '--bin', '--optimize'],
|
||||
)
|
||||
self.assertEqual(compiler_input, SMT_SMOKE_TEST_SOL_CODE)
|
||||
|
||||
|
||||
class TestParseStandardJSONOutput(PrepareReportTestBase):
|
||||
def test_parse_standard_json_output(self):
|
||||
|
||||
Reference in New Issue
Block a user