mirror of https://github.com/ConsenSys/mythril
parent
05a1b5bb7e
commit
e1f8b51c3b
@ -0,0 +1,29 @@ |
|||||||
|
import pytest |
||||||
|
import json |
||||||
|
import sys |
||||||
|
|
||||||
|
from subprocess import check_output, STDOUT |
||||||
|
from tests import PROJECT_DIR, TESTDATA |
||||||
|
|
||||||
|
MYTH = str(PROJECT_DIR / "myth") |
||||||
|
|
||||||
|
|
||||||
|
def test_positive_solc_settings(): |
||||||
|
file_dir = str(TESTDATA / "json_test_dir" / "dir_a") |
||||||
|
json_file_path = str(TESTDATA / "json_test_dir" / "test_file.json") |
||||||
|
file_path = file_dir + "/input_file.sol" |
||||||
|
|
||||||
|
command = f"cd {file_dir} && python3 {MYTH} analyze {file_path} --solc-json {json_file_path} --solv 0.8.0" |
||||||
|
output = check_output(command, shell=True, stderr=STDOUT).decode("UTF-8") |
||||||
|
assert "The analysis was completed successfully" in output |
||||||
|
|
||||||
|
|
||||||
|
def test_negative_solc_settings(): |
||||||
|
file_path = str(TESTDATA / "json_test_dir" / "dir_a" / "input_file.sol") |
||||||
|
|
||||||
|
command = f"python3 {MYTH} analyze {file_path} --solv 0.8.0" |
||||||
|
output = check_output(command, shell=True, stderr=STDOUT).decode("UTF-8") |
||||||
|
assert ( |
||||||
|
"""ParserError: Source "@openzeppelin/contracts/token/PRC20/PRC20.sol""" |
||||||
|
in output |
||||||
|
) |
@ -0,0 +1,8 @@ |
|||||||
|
pragma solidity ^0.8.0; |
||||||
|
|
||||||
|
contract PRC20{ |
||||||
|
function nothing1(uint256 a, uint256 b) public pure returns(uint256) { |
||||||
|
return a+b; |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,7 @@ |
|||||||
|
import "@openzeppelin/contracts/token/PRC20/PRC20.sol"; |
||||||
|
|
||||||
|
contract Nothing is PRC20{ |
||||||
|
function nothing() public pure{ |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,6 @@ |
|||||||
|
{ |
||||||
|
"remappings": [ "@openzeppelin/contracts/token/PRC20/=../" ], |
||||||
|
"optimizer": { |
||||||
|
"enabled": true |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue