mirror of https://github.com/crytic/slither
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
799 B
21 lines
799 B
2 years ago
|
from pathlib import Path
|
||
|
from solc_select import solc_select
|
||
|
|
||
|
from slither import Slither
|
||
|
from slither.core.declarations.function import FunctionType
|
||
|
|
||
|
TEST_DATA_DIR = Path(__file__).resolve().parent / "test_data"
|
||
|
|
||
|
|
||
|
def test_fallback_receive():
|
||
|
solc_select.switch_global_version("0.6.12", always_install=True)
|
||
|
file = Path(TEST_DATA_DIR, "fallback.sol").as_posix()
|
||
|
slither = Slither(file)
|
||
|
fake_fallback = slither.get_contract_from_name("FakeFallback")[0]
|
||
|
real_fallback = slither.get_contract_from_name("Fallback")[0]
|
||
|
|
||
|
assert fake_fallback.fallback_function is None
|
||
|
assert fake_fallback.receive_function is None
|
||
|
assert real_fallback.fallback_function.function_type == FunctionType.FALLBACK
|
||
|
assert real_fallback.receive_function.function_type == FunctionType.RECEIVE
|