From c54814b47bbc77e6754218ab1bdd479e87711b55 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 28 Nov 2018 12:18:32 +0100 Subject: Tests. --- test/libsolidity/syntaxTests/getter/complex_struct.sol | 7 +++++++ test/libsolidity/syntaxTests/getter/nested_structs.sol | 11 +++++++++++ test/libsolidity/syntaxTests/getter/recursive_struct.sol | 8 ++++++++ test/libsolidity/syntaxTests/getter/simple_struct.sol | 6 ++++++ 4 files changed, 32 insertions(+) create mode 100644 test/libsolidity/syntaxTests/getter/complex_struct.sol create mode 100644 test/libsolidity/syntaxTests/getter/nested_structs.sol create mode 100644 test/libsolidity/syntaxTests/getter/recursive_struct.sol create mode 100644 test/libsolidity/syntaxTests/getter/simple_struct.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/getter/complex_struct.sol b/test/libsolidity/syntaxTests/getter/complex_struct.sol new file mode 100644 index 00000000..3fa8111c --- /dev/null +++ b/test/libsolidity/syntaxTests/getter/complex_struct.sol @@ -0,0 +1,7 @@ +contract C { + struct Y { + uint a; + uint b; + } + mapping(uint256 => Y) public m; +} diff --git a/test/libsolidity/syntaxTests/getter/nested_structs.sol b/test/libsolidity/syntaxTests/getter/nested_structs.sol new file mode 100644 index 00000000..1068f287 --- /dev/null +++ b/test/libsolidity/syntaxTests/getter/nested_structs.sol @@ -0,0 +1,11 @@ +contract C { + struct Y { + uint b; + } + struct X { + Y a; + } + mapping(uint256 => X) public m; +} +// ---- +// TypeError: (88-118): The following types are only supported for getters in the new experimental ABI encoder: struct C.Y memory. Either remove "public" or use "pragma experimental ABIEncoderV2;" to enable the feature. diff --git a/test/libsolidity/syntaxTests/getter/recursive_struct.sol b/test/libsolidity/syntaxTests/getter/recursive_struct.sol new file mode 100644 index 00000000..d81cac60 --- /dev/null +++ b/test/libsolidity/syntaxTests/getter/recursive_struct.sol @@ -0,0 +1,8 @@ +contract C { + struct Y { + Y[] x; + } + mapping(uint256 => Y) public m; +} +// ---- +// TypeError: (53-83): Internal or recursive type is not allowed for public state variables. diff --git a/test/libsolidity/syntaxTests/getter/simple_struct.sol b/test/libsolidity/syntaxTests/getter/simple_struct.sol new file mode 100644 index 00000000..c7a23ae9 --- /dev/null +++ b/test/libsolidity/syntaxTests/getter/simple_struct.sol @@ -0,0 +1,6 @@ +contract C { + struct Y { + uint b; + } + mapping(uint256 => Y) public m; +} -- cgit