Add test for OutOfRangeError.
This commit is contained in:
parent
a5bb254ac6
commit
3ffe28e364
2 changed files with 12 additions and 4 deletions
|
@ -256,6 +256,14 @@ func TestNewBlockFromBlockAndBytes(t *testing.T) {
|
|||
|
||||
// TestBlockErrors tests the error paths for the Block API.
|
||||
func TestBlockErrors(t *testing.T) {
|
||||
// Ensure out of range errors are as expected.
|
||||
wantErr := "transaction index -1 is out of range - max 3"
|
||||
testErr := btcutil.OutOfRangeError(wantErr)
|
||||
if testErr.Error() != wantErr {
|
||||
t.Errorf("OutOfRangeError: wrong error - got %v, want %v",
|
||||
testErr.Error(), wantErr)
|
||||
}
|
||||
|
||||
// Encode the test block to bytes.
|
||||
pver := btcwire.ProtocolVersion
|
||||
var block100000Buf bytes.Buffer
|
||||
|
|
|
@ -3,14 +3,14 @@ github.com/conformal/btcutil/block.go Block.TxSha 100.00% (11/11)
|
|||
github.com/conformal/btcutil/block.go Block.TxShas 100.00% (10/10)
|
||||
github.com/conformal/btcutil/block.go NewBlockFromBytes 100.00% (7/7)
|
||||
github.com/conformal/btcutil/block.go Block.Sha 100.00% (5/5)
|
||||
github.com/conformal/btcutil/block.go NewBlockFromBlockAndBytes 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go OutOfRangeError.Error 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go Block.MsgBlock 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go Block.ProtocolVersion 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go NewBlock 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go NewBlockFromBlockAndBytes 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go Block.Height 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go Block.SetHeight 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go NewBlock 100.00% (1/1)
|
||||
github.com/conformal/btcutil/block.go Block.Bytes 88.89% (8/9)
|
||||
github.com/conformal/btcutil/block.go Block.TxLoc 77.78% (7/9)
|
||||
github.com/conformal/btcutil/block.go OutOfRangeError.Error 0.00% (0/1)
|
||||
github.com/conformal/btcutil ------------------------- 93.10% (54/58)
|
||||
github.com/conformal/btcutil ------------------------- 94.83% (55/58)
|
||||
|
||||
|
|
Loading…
Reference in a new issue