Static Analyzer for Solidity
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.
 
 
 
 
slither/tests/unit/core/test_fallback_receive.py

20 lines
799 B

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