|
|
@ -31,7 +31,7 @@ def test_node() -> None: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_collision() -> None: |
|
|
|
def test_collision() -> None: |
|
|
|
|
|
|
|
solc_select.switch_global_version("0.8.0", always_install=True) |
|
|
|
standard_json = SolcStandardJson() |
|
|
|
standard_json = SolcStandardJson() |
|
|
|
standard_json.add_source_file("./tests/collisions/a.sol") |
|
|
|
standard_json.add_source_file("./tests/collisions/a.sol") |
|
|
|
standard_json.add_source_file("./tests/collisions/b.sol") |
|
|
|
standard_json.add_source_file("./tests/collisions/b.sol") |
|
|
@ -43,6 +43,7 @@ def test_collision() -> None: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_cycle() -> None: |
|
|
|
def test_cycle() -> None: |
|
|
|
|
|
|
|
solc_select.switch_global_version("0.8.0", always_install=True) |
|
|
|
slither = Slither("./tests/test_cyclic_import/a.sol") |
|
|
|
slither = Slither("./tests/test_cyclic_import/a.sol") |
|
|
|
_run_all_detectors(slither) |
|
|
|
_run_all_detectors(slither) |
|
|
|
|
|
|
|
|
|
|
@ -74,6 +75,27 @@ def test_upgradeable_comments() -> None: |
|
|
|
assert v1.upgradeable_version == "version_1" |
|
|
|
assert v1.upgradeable_version == "version_1" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_contract_comments() -> None: |
|
|
|
|
|
|
|
comments = " @title Test Contract\n @dev Test comment" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
solc_select.switch_global_version("0.8.10", always_install=True) |
|
|
|
|
|
|
|
slither = Slither("./tests/custom_comments/contract_comment.sol") |
|
|
|
|
|
|
|
compilation_unit = slither.compilation_units[0] |
|
|
|
|
|
|
|
contract = compilation_unit.get_contract_from_name("A")[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert contract.comments == comments |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Old solc versions have a different parsing of comments |
|
|
|
|
|
|
|
# the initial space (after *) is also not kept on every line |
|
|
|
|
|
|
|
comments = "@title Test Contract\n@dev Test comment" |
|
|
|
|
|
|
|
solc_select.switch_global_version("0.5.16", always_install=True) |
|
|
|
|
|
|
|
slither = Slither("./tests/custom_comments/contract_comment.sol") |
|
|
|
|
|
|
|
compilation_unit = slither.compilation_units[0] |
|
|
|
|
|
|
|
contract = compilation_unit.get_contract_from_name("A")[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert contract.comments == comments |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_using_for_top_level_same_name() -> None: |
|
|
|
def test_using_for_top_level_same_name() -> None: |
|
|
|
solc_select.switch_global_version("0.8.15", always_install=True) |
|
|
|
solc_select.switch_global_version("0.8.15", always_install=True) |
|
|
|
slither = Slither("./tests/ast-parsing/using-for-3-0.8.0.sol") |
|
|
|
slither = Slither("./tests/ast-parsing/using-for-3-0.8.0.sol") |
|
|
|