yeah this test wasn't very good before.

master
Jordan Orelli 11 years ago
parent 738881cf97
commit 2834dec785

@ -48,7 +48,7 @@ func readValue(r io.Reader) (value, error) {
line, err := br.ReadBytes('\n')
switch err {
case io.EOF:
if line != nil {
if line != nil && len(line) > 0 {
break
}
return nil, err
@ -109,7 +109,7 @@ func readInteger(b []byte) (value, error) {
return Integer(i), nil
}
// -----------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
type BulkString string

@ -130,15 +130,24 @@ func (s streamTest) run(t *testing.T) {
c, e := make(chan value), make(chan error)
r := strings.NewReader(s[0].(string))
go streamValues(r, c, e)
for i := 1; i < len(s); i++ {
count := 1
for {
select {
case v := <-c:
if !eq(s[i], v) {
t.Errorf("expected %v, got %v", s[i], v)
case v, ok := <-c:
if !ok {
return
}
if !eq(s[count], v) {
t.Errorf("expected %q, got %q", s[count], v)
}
case err, ok := <-e:
if !ok {
return
}
case err := <-e:
t.Error(err)
return
}
count++
}
}

Loading…
Cancel
Save