accounts/abi: fix ugly hack and fix error type declaration.

Signed-off-by: RJ Catalano <rj@monax.io>
This commit is contained in:
RJ Catalano 2017-06-26 07:57:47 -05:00
parent ef557bb759
commit 441b6d6093
No known key found for this signature in database
GPG key ID: D4AB109D9B5D6386
2 changed files with 2 additions and 8 deletions

View file

@ -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

View file

@ -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)
} }