|
|
@ -10,7 +10,9 @@ TEST_FILES = Path(__file__).parent / "testdata/input_contracts" |
|
|
|
class SolidityContractTest(BaseTestCase): |
|
|
|
class SolidityContractTest(BaseTestCase): |
|
|
|
def test_get_source_info_without_name_gets_latest_contract_info(self): |
|
|
|
def test_get_source_info_without_name_gets_latest_contract_info(self): |
|
|
|
input_file = TEST_FILES / "multi_contracts.sol" |
|
|
|
input_file = TEST_FILES / "multi_contracts.sol" |
|
|
|
contract = SolidityContract(str(input_file), solc_binary=Mythril._init_solc_binary('0.4.24')) |
|
|
|
contract = SolidityContract( |
|
|
|
|
|
|
|
str(input_file), solc_binary=Mythril._init_solc_binary("0.4.24") |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
code_info = contract.get_source_info(142) |
|
|
|
code_info = contract.get_source_info(142) |
|
|
|
|
|
|
|
|
|
|
@ -20,7 +22,11 @@ class SolidityContractTest(BaseTestCase): |
|
|
|
|
|
|
|
|
|
|
|
def test_get_source_info_with_contract_name_specified(self): |
|
|
|
def test_get_source_info_with_contract_name_specified(self): |
|
|
|
input_file = TEST_FILES / "multi_contracts.sol" |
|
|
|
input_file = TEST_FILES / "multi_contracts.sol" |
|
|
|
contract = SolidityContract(str(input_file), name="Transfer1", solc_binary=Mythril._init_solc_binary('0.4.24')) |
|
|
|
contract = SolidityContract( |
|
|
|
|
|
|
|
str(input_file), |
|
|
|
|
|
|
|
name="Transfer1", |
|
|
|
|
|
|
|
solc_binary=Mythril._init_solc_binary("0.4.24"), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
code_info = contract.get_source_info(142) |
|
|
|
code_info = contract.get_source_info(142) |
|
|
|
|
|
|
|
|
|
|
@ -30,7 +36,11 @@ class SolidityContractTest(BaseTestCase): |
|
|
|
|
|
|
|
|
|
|
|
def test_get_source_info_with_contract_name_specified_constructor(self): |
|
|
|
def test_get_source_info_with_contract_name_specified_constructor(self): |
|
|
|
input_file = TEST_FILES / "constructor_assert.sol" |
|
|
|
input_file = TEST_FILES / "constructor_assert.sol" |
|
|
|
contract = SolidityContract(str(input_file), name="AssertFail", solc_binary=Mythril._init_solc_binary('0.4.24')) |
|
|
|
contract = SolidityContract( |
|
|
|
|
|
|
|
str(input_file), |
|
|
|
|
|
|
|
name="AssertFail", |
|
|
|
|
|
|
|
solc_binary=Mythril._init_solc_binary("0.4.24"), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
code_info = contract.get_source_info(62, constructor=True) |
|
|
|
code_info = contract.get_source_info(62, constructor=True) |
|
|
|
|
|
|
|
|
|
|
|