Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 5633491

Browse files
committed
Add a test for solidity wrapper and extra_args
1 parent a92f9c4 commit 5633491

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

ethereum/tests/test_solidity.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,25 @@ def test_abi_contract():
271271
assert contract.seven() == 7
272272
assert contract.mul2(2) == 4
273273
assert contract.mul2(-2) == -4
274+
275+
@pytest.mark.skipif(not SOLIDITY_AVAILABLE, reason='solc compiler not available')
276+
def test_extra_args():
277+
src = """
278+
contract foo {
279+
function add7(uint a) returns(uint d) { return a + 7; }
280+
function add42(uint a) returns(uint d) { return a + 42; }
281+
}
282+
"""
283+
284+
contract_info = get_solidity().compile_rich(
285+
src,
286+
extra_args="--optimize-runs 100"
287+
)
288+
expected_code = '0x6060604052605c8060106000396000f3606060405260e060020a6000350463651ae23981146026578063cb02919f146039575b6002565b34600257604a600435600781015b919050565b34600257604a600435602a81016034565b60408051918252519081900360200190f3'
289+
assert expected_code == contract_info['foo']['code']
290+
291+
contract_info = get_solidity().compile_rich(
292+
src,
293+
extra_args=["--optimize-runs", "100"]
294+
)
295+
assert expected_code == contract_info['foo']['code']

0 commit comments

Comments
 (0)