From a38352569b1112a3f252f18868ead0946c034386 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 9 Aug 2018 01:27:22 +0200 Subject: Tests. --- .../specialFunctions/encodePacked_array_of_structs.sol | 9 +++++++++ .../syntaxTests/specialFunctions/encode_array_of_struct.sol | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol create mode 100644 test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol (limited to 'test/libsolidity') diff --git a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol new file mode 100644 index 00000000..036e108a --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol @@ -0,0 +1,9 @@ +contract C { + struct S { uint x; } + function f() public pure { + S[] memory s; + abi.encodePacked(s); + } +} +// ---- +// TypeError: (116-117): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol b/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol new file mode 100644 index 00000000..7a4d8250 --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol @@ -0,0 +1,10 @@ +pragma experimental ABIEncoderV2; +contract C { + struct S { uint x; } + function f() public pure { + S[] memory s; + abi.encode(s); + } +} +// ---- +// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. -- cgit