Skip to content

Commit

Permalink
Move isReady tests to the proper file
Browse files Browse the repository at this point in the history
  • Loading branch information
flimzy committed Oct 10, 2023
1 parent 6fa7656 commit 6e5d12f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
31 changes: 0 additions & 31 deletions bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,6 @@ import (
"github.com/go-kivik/kivik/v4/internal/mock"
)

func Test_iter_isReady(t *testing.T) {
tests := []struct {
name string
iter *iter
err string
}{
{
name: "not ready",
iter: &iter{},
err: "kivik: Iterator access before calling Next",
},
{
name: "closed",
iter: &iter{state: stateClosed},
err: "kivik: Iterator is closed",
},
{
name: "success",
iter: &iter{state: stateRowReady},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
err := test.iter.isReady()
if !testy.ErrorMatches(test.err, err) {
t.Errorf("Unexpected error: %s", err)
}
})
}
}

func TestDocsInterfaceSlice(t *testing.T) {
type diTest struct {
name string
Expand Down
31 changes: 31 additions & 0 deletions iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,34 @@ func TestCancelledIterator(t *testing.T) {
t.Errorf("Unexpected error: %s", err)
}
}

func Test_iter_isReady(t *testing.T) {
tests := []struct {
name string
iter *iter
err string
}{
{
name: "not ready",
iter: &iter{},
err: "kivik: Iterator access before calling Next",
},
{
name: "closed",
iter: &iter{state: stateClosed},
err: "kivik: Iterator is closed",
},
{
name: "success",
iter: &iter{state: stateRowReady},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
err := test.iter.isReady()
if !testy.ErrorMatches(test.err, err) {
t.Errorf("Unexpected error: %s", err)
}
})
}
}

0 comments on commit 6e5d12f

Please sign in to comment.