Tests and typos.
Increase test coverage. Fix spelling and typos in a comment. Minor update to todo in README.md
This commit is contained in:
parent
e3c9ebd26f
commit
796df5b105
4 changed files with 9 additions and 5 deletions
|
@ -58,7 +58,8 @@ $ go get github.com/conformal/btcjson
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Add data structures for remaining commands.
|
- Add data structures for remaining commands.
|
||||||
- Increase test coverage to 100%
|
- Increase test coverage to 100%.
|
||||||
|
- Add https support.
|
||||||
|
|
||||||
## GPG Verification Key
|
## GPG Verification Key
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,11 @@ var resulttests = []struct {
|
||||||
{"getinfo", []byte(`{"error":null,"result":null}`), false, false},
|
{"getinfo", []byte(`{"error":null,"result":null}`), false, false},
|
||||||
{"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
{"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||||
{"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
{"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||||
|
{"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true},
|
||||||
{"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
{"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||||
|
{"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true},
|
||||||
{"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
{"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||||
|
{"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true},
|
||||||
{"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
{"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||||
{"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true},
|
{"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true},
|
||||||
}
|
}
|
||||||
|
|
|
@ -674,8 +674,8 @@ func readResultCmd(cmd string, message []byte) (Reply, error) {
|
||||||
}
|
}
|
||||||
result.Result = res
|
result.Result = res
|
||||||
// For commands that return a single item, we get it with the
|
// For commands that return a single item, we get it with the
|
||||||
// correct concrete type for free (but treat them seperately
|
// correct concrete type for free (but treat them separately
|
||||||
// for clarity.
|
// for clarity).
|
||||||
case "getblockcount":
|
case "getblockcount":
|
||||||
err = json.Unmarshal(message, &result)
|
err = json.Unmarshal(message, &result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,7 +6,7 @@ github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7)
|
||||||
github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6)
|
github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6)
|
||||||
github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5)
|
github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5)
|
||||||
github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3)
|
github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3)
|
||||||
github.com/conformal/btcjson/jsonapi.go readResultCmd 85.00% (51/60)
|
github.com/conformal/btcjson/jsonapi.go readResultCmd 90.16% (55/61)
|
||||||
github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27)
|
github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27)
|
||||||
github.com/conformal/btcjson --------------- 95.91% (422/440)
|
github.com/conformal/btcjson --------------- 96.60% (426/441)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue