blockchain: make scriptval_test fail more nicely

Return early when failing on len(blocks) > 1.

Check for len(blocks) == 0 so we can fail on that condition with an
error message instead of a panic.
This commit is contained in:
Chris Martin 2016-09-16 15:44:27 -04:00
parent fb90c334df
commit c20db1cf14

View file

@ -27,6 +27,11 @@ func TestCheckBlockScripts(t *testing.T) {
} }
if len(blocks) > 1 { if len(blocks) > 1 {
t.Errorf("The test block file must only have one block in it") t.Errorf("The test block file must only have one block in it")
return
}
if len(blocks) == 0 {
t.Errorf("The test block file may not be empty")
return
} }
storeDataFile := fmt.Sprintf("%d.utxostore.bz2", testBlockNum) storeDataFile := fmt.Sprintf("%d.utxostore.bz2", testBlockNum)