diff options
author | Felix Lange <fjl@users.noreply.github.com> | 2017-01-13 16:45:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-13 16:45:40 +0800 |
commit | 01f6f2d741e717f669b7ba1d6b88991f28e30c72 (patch) | |
tree | f87ea1219834c44cd2e8ab6a64da9c49edef37cb /common/hexutil/json_test.go | |
parent | c5df37c1119107ddcc517127b3bd7c2ab4e3649f (diff) | |
download | dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.gz dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.bz2 dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.lz dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.xz dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.tar.zst dexon-01f6f2d741e717f669b7ba1d6b88991f28e30c72.zip |
common/hexutil: allow empty strings when decoding JSON (#3559)
Diffstat (limited to 'common/hexutil/json_test.go')
-rw-r--r-- | common/hexutil/json_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/hexutil/json_test.go b/common/hexutil/json_test.go index 2d2e2fc0f..290bf9ca2 100644 --- a/common/hexutil/json_test.go +++ b/common/hexutil/json_test.go @@ -60,13 +60,13 @@ var unmarshalBytesTests = []unmarshalTest{ {input: "", wantErr: errNonString}, {input: "null", wantErr: errNonString}, {input: "10", wantErr: errNonString}, - {input: `""`, wantErr: ErrEmptyString}, {input: `"0"`, wantErr: ErrMissingPrefix}, {input: `"0x0"`, wantErr: ErrOddLength}, {input: `"0xxx"`, wantErr: ErrSyntax}, {input: `"0x01zz01"`, wantErr: ErrSyntax}, // valid encoding + {input: `""`, want: referenceBytes("")}, {input: `"0x"`, want: referenceBytes("")}, {input: `"0x02"`, want: referenceBytes("02")}, {input: `"0X02"`, want: referenceBytes("02")}, @@ -125,7 +125,6 @@ var unmarshalBigTests = []unmarshalTest{ {input: "", wantErr: errNonString}, {input: "null", wantErr: errNonString}, {input: "10", wantErr: errNonString}, - {input: `""`, wantErr: ErrEmptyString}, {input: `"0"`, wantErr: ErrMissingPrefix}, {input: `"0x"`, wantErr: ErrEmptyNumber}, {input: `"0x01"`, wantErr: ErrLeadingZero}, @@ -133,6 +132,7 @@ var unmarshalBigTests = []unmarshalTest{ {input: `"0x1zz01"`, wantErr: ErrSyntax}, // valid encoding + {input: `""`, want: big.NewInt(0)}, {input: `"0x0"`, want: big.NewInt(0)}, {input: `"0x2"`, want: big.NewInt(0x2)}, {input: `"0x2F2"`, want: big.NewInt(0x2f2)}, @@ -198,7 +198,6 @@ var unmarshalUint64Tests = []unmarshalTest{ {input: "", wantErr: errNonString}, {input: "null", wantErr: errNonString}, {input: "10", wantErr: errNonString}, - {input: `""`, wantErr: ErrEmptyString}, {input: `"0"`, wantErr: ErrMissingPrefix}, {input: `"0x"`, wantErr: ErrEmptyNumber}, {input: `"0x01"`, wantErr: ErrLeadingZero}, @@ -207,6 +206,7 @@ var unmarshalUint64Tests = []unmarshalTest{ {input: `"0x1zz01"`, wantErr: ErrSyntax}, // valid encoding + {input: `""`, want: uint64(0)}, {input: `"0x0"`, want: uint64(0)}, {input: `"0x2"`, want: uint64(0x2)}, {input: `"0x2F2"`, want: uint64(0x2f2)}, |