Minor fixes.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
This commit is contained in:
Bartlomiej Plotka 2020-02-10 12:46:10 +00:00
parent 2cf637fbf5
commit 849faa407b
2 changed files with 3 additions and 4 deletions

View file

@ -411,10 +411,9 @@ func (cmd clearCmd) String() string {
// is reached, evaluation errors do not terminate execution.
func (t *Test) Run() error {
for _, cmd := range t.cmds {
err := t.exec(cmd)
// TODO(fabxc): aggregate command errors, yield diffs for result
// comparison errors.
if err != nil {
if err := t.exec(cmd); err != nil {
return err
}
}
@ -443,6 +442,7 @@ func (t *Test) exec(tc testCommand) error {
if err != nil {
return err
}
defer q.Close()
res := q.Exec(t.context)
if res.Err != nil {
if cmd.fail {
@ -450,7 +450,6 @@ func (t *Test) exec(tc testCommand) error {
}
return errors.Wrapf(res.Err, "error evaluating query %q (line %d)", cmd.expr, cmd.line)
}
defer q.Close()
if res.Err == nil && cmd.fail {
return errors.Errorf("expected error evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
}

View file

@ -88,7 +88,7 @@ type Iterator interface {
// TODO(bwplotka): Verify above statement on all implementations with unit test.
At() (int64, float64)
// Err returns the current error.
// Err can return undefined value before the iterator has advanced.
// Err can return undefined value before calling `Next` or `Seek`.
Err() error
}