-
-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/vyperlang/vyper into refa…
…ctor/folding_alt
- Loading branch information
Showing
13 changed files
with
132 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pytest | ||
|
||
from vyper import compiler | ||
from vyper.exceptions import TypeMismatch | ||
|
||
fail_list = [ | ||
( | ||
""" | ||
@external | ||
def foo(j: uint256) -> bool: | ||
s: bool = _abi_decode(j, bool, unwrap_tuple= False) | ||
return s | ||
""", | ||
TypeMismatch, | ||
), | ||
( | ||
""" | ||
@external | ||
def bar(j: String[32]) -> bool: | ||
s: bool = _abi_decode(j, bool, unwrap_tuple= False) | ||
return s | ||
""", | ||
TypeMismatch, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("bad_code,exc", fail_list) | ||
def test_abi_encode_fail(bad_code, exc): | ||
with pytest.raises(exc): | ||
compiler.compile_code(bad_code) | ||
|
||
|
||
valid_list = [ | ||
""" | ||
@external | ||
def foo(x: Bytes[32]) -> uint256: | ||
return _abi_decode(x, uint256) | ||
""" | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("good_code", valid_list) | ||
def test_abi_encode_success(good_code): | ||
assert compiler.compile_code(good_code) is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters