mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
accounts/abi: fix ugly hack and fix error type declaration.
Signed-off-by: RJ Catalano <rj@monax.io>
This commit is contained in:
parent
ef557bb759
commit
441b6d6093
2 changed files with 2 additions and 8 deletions
|
|
@ -23,7 +23,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
errBadBool error = errors.New("abi: improperly encoded boolean value")
|
errBadBool = errors.New("abi: improperly encoded boolean value")
|
||||||
)
|
)
|
||||||
|
|
||||||
// formatSliceString formats the reflection kind with the given slice size
|
// formatSliceString formats the reflection kind with the given slice size
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ func TestSimpleMethodUnpack(t *testing.T) {
|
||||||
case "hash":
|
case "hash":
|
||||||
var v common.Hash
|
var v common.Hash
|
||||||
err = abi.Unpack(&v, "method", test.marshalledOutput)
|
err = abi.Unpack(&v, "method", test.marshalledOutput)
|
||||||
outvar = v
|
outvar = v.Bytes()[:]
|
||||||
case "function":
|
case "function":
|
||||||
var v [24]byte
|
var v [24]byte
|
||||||
err = abi.Unpack(&v, "method", test.marshalledOutput)
|
err = abi.Unpack(&v, "method", test.marshalledOutput)
|
||||||
|
|
@ -222,12 +222,6 @@ func TestSimpleMethodUnpack(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// bit of an ugly hack for hash type but I don't feel like finding a proper solution
|
|
||||||
if test.outVar == "hash" {
|
|
||||||
tmp := outvar.(common.Hash) // without assignment it's unaddressable
|
|
||||||
outvar = tmp[:]
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(test.expectedOut, outvar) {
|
if !reflect.DeepEqual(test.expectedOut, outvar) {
|
||||||
t.Errorf("%d failed. Output error: expected %v, got %v", i, test.expectedOut, outvar)
|
t.Errorf("%d failed. Output error: expected %v, got %v", i, test.expectedOut, outvar)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue