mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Cleanup ABICoder V1 tests
Include the pragma explicitly, rename the file to have a _v1 suffix, and also add V2 counterparts where missing.
This commit is contained in:
parent
1d41ceaed4
commit
299873182b
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f1() public returns (bytes memory) {
|
||||
return abi.encode("");
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(bool b) public pure returns (bool) { return b; }
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(uint16 a, int16 b, address c, bytes3 d, bool e)
|
||||
public pure returns (uint v, uint w, uint x, uint y, uint z) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
enum E { A, B }
|
||||
function f(E e) public pure returns (uint x) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
// Tests that this will not end up using a "bytes0" type
|
||||
// (which would assert)
|
||||
contract C {
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
// Input is still not checked - this needs ABIEncoderV2!
|
||||
function f(uint16 a, uint16 b) public returns (uint16) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(bool _b) public returns (uint256) {
|
||||
if (_b) return 1;
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
// Checks that address types are properly cleaned before they are compared.
|
||||
contract C {
|
||||
function f(address a) public returns (uint256) {
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
// Checks that bytesXX types are properly cleaned before they are compared.
|
||||
contract C {
|
||||
function f(bytes2 a, uint16 x) public returns (uint256) {
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(int8 a, uint8 b) public returns (int256) {
|
||||
assembly {
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(uint8 a, uint8 b) public returns (uint256) {
|
||||
assembly {
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(int16 a, uint16 b) public returns (int16) {
|
||||
return a >> b;
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(int32 a, uint32 b) public returns (int32) {
|
||||
return a >> b;
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function f(int8 a, uint8 b) public returns (int8) {
|
||||
return a >> b;
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function d(bytes memory _data) public pure returns (uint8) {
|
||||
return abi.decode(_data, (uint8));
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
enum E {X, Y}
|
||||
function f(E[] calldata arr) external {
|
13
test/libsolidity/semanticTests/revertStrings/enum_v2.sol
Normal file
13
test/libsolidity/semanticTests/revertStrings/enum_v2.sol
Normal file
@ -0,0 +1,13 @@
|
||||
pragma abicoder v2;
|
||||
contract C {
|
||||
enum E {X, Y}
|
||||
function f(E[] calldata arr) external {
|
||||
arr[1];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// compileViaYul: also
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
// f(uint8[]): 0x20, 2, 3, 3 -> FAILURE
|
@ -4,6 +4,7 @@ contract C {
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// ABIEncoderV1Only: true
|
||||
// compileViaYul: false
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
|
@ -1,10 +0,0 @@
|
||||
pragma abicoder v2;
|
||||
contract C {
|
||||
function t(uint) public pure {}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// compileViaYul: also
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 34, "ABI decoding: tuple data too sho", "rt"
|
@ -1,9 +1,10 @@
|
||||
pragma abicoder v2;
|
||||
contract C {
|
||||
function t(uint) public pure {}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 34, "ABI decoding: tuple data too sho", "rt"
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function d(bytes memory _data) public pure returns (uint8) {
|
||||
return abi.decode(_data, (uint8));
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function dyn(uint ptr, uint start, uint x) public returns (bytes memory a) {
|
||||
assembly {
|
||||
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
contract test {
|
||||
enum E { A, B, C }
|
||||
mapping(E => uint8) public table;
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
enum E { A, B, C }
|
||||
library L {
|
||||
function get(mapping(E => uint8) storage table, E k) external returns (uint8) {
|
@ -1,3 +1,4 @@
|
||||
pragma abicoder v1;
|
||||
enum E { A, B, C }
|
||||
contract test {
|
||||
mapping(E => uint8) table;
|
Loading…
Reference in New Issue
Block a user