Skip to content

Commit

Permalink
nil scan
Browse files Browse the repository at this point in the history
  • Loading branch information
adoublef committed Apr 7, 2024
1 parent a31c450 commit b622592
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion time/date/date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,21 @@ func Test_Date_Scan(t *testing.T) {
is.NoErr(err) // sql3.DB).QueryRow
})

t.Run("Null", func(t *testing.T) {
t.Run("Zero", func(t *testing.T) {
is := is.NewRelaxed(t)
var d Date
err = db.QueryRow(context.TODO(), `select d from t where id = 2`).Scan(&d)
is.NoErr(err) // sql3.DB).QueryRow
})

t.Run("Nil", func(t *testing.T) {
is := is.NewRelaxed(t)
var d *Date
err = db.QueryRow(context.TODO(), `select d from t where id = 2`).Scan(&d)
is.NoErr(err) // sql3.DB).QueryRow

is.Equal(d, nil)
})
}

func Test_Date_Value(t *testing.T) {
Expand Down

0 comments on commit b622592

Please sign in to comment.