Fix NPM code block issue (#1602)

* Init config dir

* Fix solc optimizer

* Fix NPM code block issue

* Extend tests
pull/1608/head
Nikhil Parasaram 3 years ago committed by GitHub
parent cf0cb1520b
commit 8fbe2e2748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      mythril/ethereum/util.py
  2. 9
      tests/util_tests.py

@ -141,7 +141,7 @@ def extract_version(file: str) -> Optional[str]:
for line in file.split("\n"): for line in file.split("\n"):
if "pragma solidity" not in line: if "pragma solidity" not in line:
continue continue
version_line = line version_line = line.rstrip()
break break
if version_line is None: if version_line is None:
return None return None

@ -7,6 +7,15 @@ test_data = (
("pragma solidity 0.5.0\n", ["0.5.0"]), ("pragma solidity 0.5.0\n", ["0.5.0"]),
("pragma solidity ^0.4.26\n", ["0.4.26"]), ("pragma solidity ^0.4.26\n", ["0.4.26"]),
("pragma solidity ^0.6.3;\n", [f"0.6.{x}" for x in range(3, 13)]), ("pragma solidity ^0.6.3;\n", [f"0.6.{x}" for x in range(3, 13)]),
("pragma solidity ^0.6.3 ;\n", [f"0.6.{x}" for x in range(3, 13)]),
(
"pragma solidity ^0.6.3; \n",
[f"0.6.{x}" for x in range(3, 13)],
),
(
"pragma solidity ^0.6.3 ; \n",
[f"0.6.{x}" for x in range(3, 13)],
),
( (
"""pragma solidity >=0.4.0 <0.6.0 ; """pragma solidity >=0.4.0 <0.6.0 ;
contract SimpleStorage { contract SimpleStorage {

Loading…
Cancel
Save