From c08cbee3ecef9925b0b923aacc5d1e83afc69619 Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Fri, 10 Mar 2023 11:46:18 +0100 Subject: [PATCH] Add tests --- tests/function_features/abstract.sol | 5 +++++ tests/function_features/implicit_abstract.sol | 5 +++++ tests/test_features.py | 15 +++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 tests/function_features/abstract.sol create mode 100644 tests/function_features/implicit_abstract.sol diff --git a/tests/function_features/abstract.sol b/tests/function_features/abstract.sol new file mode 100644 index 000000000..b29f683c4 --- /dev/null +++ b/tests/function_features/abstract.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.8.0; + +abstract contract ExplicitAbstract{ + function f() virtual public; +} diff --git a/tests/function_features/implicit_abstract.sol b/tests/function_features/implicit_abstract.sol new file mode 100644 index 000000000..c46ccd821 --- /dev/null +++ b/tests/function_features/implicit_abstract.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.5.0; + +contract ImplicitAbstract{ + function f() public; +} \ No newline at end of file diff --git a/tests/test_features.py b/tests/test_features.py index 68a21a884..20393df38 100644 --- a/tests/test_features.py +++ b/tests/test_features.py @@ -202,3 +202,18 @@ def test_using_for_global_collision() -> None: compilation = CryticCompile(standard_json) sl = Slither(compilation) _run_all_detectors(sl) + + +def test_abstract_contract() -> None: + solc_select.switch_global_version("0.8.0", always_install=True) + slither = Slither("./tests/function_features/abstract.sol") + assert not slither.contracts[0].is_fully_implemented + + solc_select.switch_global_version("0.5.0", always_install=True) + slither = Slither("./tests/function_features/implicit_abstract.sol") + assert not slither.contracts[0].is_fully_implemented + + slither = Slither( + "./tests/function_features/implicit_abstract.sol", solc_force_legacy_json=True + ) + assert not slither.contracts[0].is_fully_implemented