mirror of https://github.com/certusone/wasmd.git
Test nil key and adapt docs
This commit is contained in:
parent
b4d22c63f8
commit
d2d204891c
|
@ -421,7 +421,7 @@ func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []b
|
|||
return queryResult, nil
|
||||
}
|
||||
|
||||
// QueryRaw returns the contract's state for give key. For a `nil` key a empty slice result is returned.
|
||||
// QueryRaw returns the contract's state for give key. Returns `nil` when key is `nil`.
|
||||
func (k Keeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte {
|
||||
if key == nil {
|
||||
return nil
|
||||
|
|
|
@ -104,6 +104,12 @@ func TestQueryContractState(t *testing.T) {
|
|||
},
|
||||
"query empty raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("")},
|
||||
expRes: nil,
|
||||
},
|
||||
"query nil raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: nil},
|
||||
expRes: nil,
|
||||
},
|
||||
"query raw with unknown address": {
|
||||
|
|
Loading…
Reference in New Issue