progress
parent
cafb40514c
commit
ed75a59ca0
|
|
@ -70,5 +70,20 @@ func (file File) transactions() ([]transaction, error) {
|
|||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
return nil, io.EOF
|
||||
|
||||
result := make([]transaction, 0)
|
||||
for {
|
||||
one, err := readTransaction(f)
|
||||
result = append(result, one)
|
||||
if err == io.EOF {
|
||||
return result, nil
|
||||
}
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func readTransaction(r io.Reader) (transaction, error) {
|
||||
return transaction{}, io.EOF
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ func TestFileDeltas(t *testing.T) {
|
|||
t.Error(len(deltas))
|
||||
}
|
||||
for i := range want {
|
||||
if i >= len(deltas) {
|
||||
break
|
||||
}
|
||||
if want[i] != deltas[i] {
|
||||
t.Errorf("[%d] \n\twant=%+v, \n\t got=%+v", i, want[i], deltas[i])
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue