diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-07 20:35:23 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-07 20:39:21 +0800 |
commit | ce29aac8ad52336de6534dbeb98b9ecc38da11fa (patch) | |
tree | 76125c2246417588db3991908242fb7505ee37a4 /test | |
parent | 13e37df97c4585a68f2f7f4b6296cb38abc49cea (diff) | |
download | dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.tar dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.tar.gz dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.tar.bz2 dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.tar.lz dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.tar.xz dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.tar.zst dexon-solidity-ce29aac8ad52336de6534dbeb98b9ecc38da11fa.zip |
Add more syntax tests for enums and interfaces/libraries
Diffstat (limited to 'test')
5 files changed, 48 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/parsing/enum_from_interface.sol b/test/libsolidity/syntaxTests/parsing/enum_from_interface.sol new file mode 100644 index 00000000..0fe0fbae --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/enum_from_interface.sol @@ -0,0 +1,9 @@ +interface I { + enum Direction { Left, Right } +} + +contract D { + function f() public pure returns (I.Direction) { + return I.Direction.Left; + } +} diff --git a/test/libsolidity/syntaxTests/parsing/enum_from_interface_in_library.sol b/test/libsolidity/syntaxTests/parsing/enum_from_interface_in_library.sol new file mode 100644 index 00000000..8d9003eb --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/enum_from_interface_in_library.sol @@ -0,0 +1,12 @@ +interface I { + enum Direction { Left, Right } +} + +library L { + function f() public pure returns (I.Direction) { + return I.Direction.Left; + } + function g() internal pure returns (I.Direction) { + return I.Direction.Left; + } +} diff --git a/test/libsolidity/syntaxTests/parsing/enum_from_library.sol b/test/libsolidity/syntaxTests/parsing/enum_from_library.sol new file mode 100644 index 00000000..ab762a82 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/enum_from_library.sol @@ -0,0 +1,9 @@ +library L { + enum Direction { Left, Right } +} + +contract D { + function f() public pure returns (L.Direction) { + return L.Direction.Left; + } +} diff --git a/test/libsolidity/syntaxTests/parsing/enum_inheritance_contract.sol b/test/libsolidity/syntaxTests/parsing/enum_inheritance_contract.sol new file mode 100644 index 00000000..e5b98352 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/enum_inheritance_contract.sol @@ -0,0 +1,9 @@ +contract C { + enum Direction { Left, Right } +} + +contract D is C { + function f() public pure returns (Direction) { + return Direction.Left; + } +} diff --git a/test/libsolidity/syntaxTests/parsing/enum_inheritance_interface.sol b/test/libsolidity/syntaxTests/parsing/enum_inheritance_interface.sol new file mode 100644 index 00000000..75858744 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/enum_inheritance_interface.sol @@ -0,0 +1,9 @@ +interface I { + enum Direction { Left, Right } +} + +contract D is I { + function f() public pure returns (Direction) { + return Direction.Left; + } +} |