Skip to content

Commit 4622cc6

Browse files
committed
Support for solc 0.4.17 warnings
1 parent e8688d6 commit 4622cc6

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

tests/conftest.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ def contracts_dir(tmpdir):
1313
return str(tmpdir.mkdir("contracts"))
1414

1515

16+
@pytest.fixture(scope="session")
17+
def solc_version():
18+
return get_solc_version()
19+
20+
1621
@pytest.fixture()
17-
def supported_solc_version():
18-
solc_version = get_solc_version()
22+
def supported_solc_version(solc_version):
1923
if solc_version not in Spec('>=0.4.1,<=0.4.17,!=0.4.10,!=0.4.3,!=0.4.4,!=0.4.5'):
2024
raise AssertionError("Unsupported compiler version: {0}".format(solc_version))
2125

@@ -28,18 +32,31 @@ def is_new_key_format():
2832

2933

3034
@pytest.fixture()
31-
def FOO_SOURCE(supported_solc_version):
32-
return textwrap.dedent('''\
33-
pragma solidity ^0.4.0;
35+
def FOO_SOURCE(supported_solc_version, solc_version):
36+
if solc_version in Spec('<0.4.17'):
37+
return textwrap.dedent('''\
38+
pragma solidity ^0.4.0;
3439
35-
contract Foo {
36-
function Foo() {}
40+
contract Foo {
41+
function Foo() {}
3742
38-
function return13() returns (uint) {
39-
return 13;
43+
function return13() public returns (uint) {
44+
return 13;
45+
}
4046
}
41-
}
42-
''')
47+
''')
48+
else:
49+
return textwrap.dedent('''\
50+
pragma solidity ^0.4.17;
51+
52+
contract Foo {
53+
function Foo() public {}
54+
55+
function return13() public pure returns (uint) {
56+
return 13;
57+
}
58+
}
59+
''')
4360

4461

4562
@pytest.fixture()
@@ -48,7 +65,7 @@ def BAR_SOURCE(supported_solc_version):
4865
pragma solidity ^0.4.0;
4966
5067
contract Bar {
51-
function Bar() {}
68+
function Bar() public {}
5269
}
5370
''')
5471

@@ -61,9 +78,9 @@ def BAZ_SOURCE(supported_solc_version):
6178
import "contracts/Bar.sol";
6279
6380
contract Baz is Bar {
64-
function Baz() {}
81+
function Baz() public {}
6582
66-
function get_funky() returns (string) {
83+
function get_funky() public returns (string) {
6784
return "funky";
6885
}
6986
}

0 commit comments

Comments
 (0)