Skip to content

Commit

Permalink
Add a regression test for the zero-column Query case
Browse files Browse the repository at this point in the history
Signed-off-by: Cole Miller <cole.miller@canonical.com>
  • Loading branch information
cole-miller committed Jul 17, 2023
1 parent 945a3da commit 05a146d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,21 @@ func Test_ColumnTypesEnd(t *testing.T) {
assert.NoError(t, conn.Close())
}

func Test_ZeroColumns(t *testing.T) {
drv, cleanup := newDriver(t)
defer cleanup()

conn, err := drv.Open("test.db")
require.NoError(t, err)

rows, err := conn.Query("CREATE TABLE foo (bar INTEGER)")
require.NoError(t, err)
values := []driver.Value{}
require.Equal(t, io.EOF, rows.Next(values))

require.NoError(t, conn.Close())
}

func newDriver(t *testing.T) (*dqlitedriver.Driver, func()) {
t.Helper()

Expand Down

0 comments on commit 05a146d

Please sign in to comment.