Skip to content

Commit ce8cd27

Browse files
add test cases
1 parent 0bd3e21 commit ce8cd27

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/functional/syntax/test_getters.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
from vyper.exceptions import SyntaxException
55

66

7-
def test_duplicate_public_annotation():
8-
code = """
9-
a: public(public(uint256))
7+
@pytest.mark.parametrize("annotation", ("public", "reentrant"))
8+
def test_duplicate_getter_annotation(annotation):
9+
code = f"""
10+
a: {annotation}({annotation}(uint256))
1011
"""
1112

1213
with pytest.raises(SyntaxException) as e:
1314
compile_code(code)
1415

15-
assert e.value.message == "Used variable annotation `public` multiple times"
16+
assert e.value.message == f"Used variable annotation `{annotation}` multiple times"
1617

1718

18-
def test_duplicate_reentrant_annotation():
19-
code = """
20-
a: reentrant(reentrant(uint256))
19+
@pytest.mark.parametrize("annotation", ("constant", "transient", "immutable"))
20+
def test_duplicate_location_annotation(annotation):
21+
code = f"""
22+
a: {annotation}({annotation}(uint256))
2123
"""
2224

2325
with pytest.raises(SyntaxException) as e:
2426
compile_code(code)
2527

26-
assert e.value.message == "Used variable annotation `reentrant` multiple times"
28+
# TODO: improve this error message
29+
assert e.value.message == "Invalid scope for variable declaration"

0 commit comments

Comments
 (0)