mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi: fix unit tests
This commit is contained in:
parent
763de1e1ce
commit
e2973474d4
2 changed files with 13 additions and 8 deletions
|
|
@ -61,10 +61,10 @@ func TestReader(t *testing.T) {
|
|||
exp := ABI{
|
||||
Methods: map[string]Method{
|
||||
"balance": {
|
||||
"balance", "balance", "view", false, false, nil, nil,
|
||||
"balance", "balance", "view", false, false, false, false, nil, nil,
|
||||
},
|
||||
"send": {
|
||||
"send", "send", "", false, false, []Argument{
|
||||
"send", "send", "", false, false, false, false, []Argument{
|
||||
{"amount", Uint256, false},
|
||||
}, nil,
|
||||
},
|
||||
|
|
@ -173,7 +173,7 @@ func TestTestSlice(t *testing.T) {
|
|||
|
||||
func TestMethodSignature(t *testing.T) {
|
||||
String, _ := NewType("string", "", nil)
|
||||
m := Method{"foo", "foo", "", false, false, []Argument{{"bar", String, false}, {"baz", String, false}}, nil}
|
||||
m := Method{"foo", "foo", "", false, false, false, false, []Argument{{"bar", String, false}, {"baz", String, false}}, nil}
|
||||
exp := "foo(string,string)"
|
||||
if m.Sig() != exp {
|
||||
t.Error("signature mismatch", exp, "!=", m.Sig())
|
||||
|
|
@ -185,7 +185,7 @@ func TestMethodSignature(t *testing.T) {
|
|||
}
|
||||
|
||||
uintt, _ := NewType("uint256", "", nil)
|
||||
m = Method{"foo", "foo", "", false, false, []Argument{{"bar", uintt, false}}, nil}
|
||||
m = Method{"foo", "foo", "", false, false, false, false, []Argument{{"bar", uintt, false}}, nil}
|
||||
exp = "foo(uint256)"
|
||||
if m.Sig() != exp {
|
||||
t.Error("signature mismatch", exp, "!=", m.Sig())
|
||||
|
|
@ -204,7 +204,7 @@ func TestMethodSignature(t *testing.T) {
|
|||
{Name: "y", Type: "int256"},
|
||||
}},
|
||||
})
|
||||
m = Method{"foo", "foo", "", false, false, []Argument{{"s", s, false}, {"bar", String, false}}, nil}
|
||||
m = Method{"foo", "foo", "", false, false, false, false, []Argument{{"s", s, false}, {"bar", String, false}}, nil}
|
||||
exp = "foo((int256,int256[],(int256,int256)[],(int256,int256)[2]),string)"
|
||||
if m.Sig() != exp {
|
||||
t.Error("signature mismatch", exp, "!=", m.Sig())
|
||||
|
|
|
|||
|
|
@ -41,10 +41,15 @@ type Method struct {
|
|||
// * foo(uint,uint)
|
||||
// The method name of the first one will be resolved as foo while the second one
|
||||
// will be resolved as foo0.
|
||||
Name string
|
||||
RawName string // RawName is the raw method name parsed from ABI
|
||||
StateMutability string // Indicates the mutability state of method
|
||||
Name string
|
||||
RawName string // RawName is the raw method name parsed from ABI
|
||||
|
||||
// StateMutability indicates the mutability state of method,
|
||||
// the default value is nonpayable. It can be empty if the abi
|
||||
// is generated by legacy compiler.
|
||||
StateMutability string
|
||||
|
||||
// Legacy indicators generated by compiler before v0.6.0
|
||||
Constant bool
|
||||
Payable bool
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue