diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-04-15 19:10:41 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-04-15 19:10:41 +0200 |
| commit | 0adf505773054a92d77a9c937c8c5e56e74493e0 (patch) | |
| tree | 47f3046852a5927bf7ad3f85e6c60ec97cb15f8d /select_test.go | |
| parent | a818aab2a4b48e399d5186c235149ef21011a4af (diff) | |
| download | go-oblast-0adf505773054a92d77a9c937c8c5e56e74493e0.tar.gz | |
increase test coverage for planning
Diffstat (limited to 'select_test.go')
| -rw-r--r-- | select_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/select_test.go b/select_test.go index 9fcecc3..f364e1c 100644 --- a/select_test.go +++ b/select_test.go @@ -22,11 +22,11 @@ func TestSelectReturningSomeRecords(t *testing.T) { ID int64 `db:"id"` Name string `db:"name"` } - store := must.Return(oblast.NewStore[basicRecord]( + store := oblast.MustNewStore[basicRecord]( oblast.SqliteDialect(), oblast.TableNameIs("basic_records"), oblast.PrimaryKeyIs("id"), - ))(t) + ) t.Run("using Store.Select", func(t *testing.T) { md.ForQuery(`SELECT * FROM basic_records WHERE id < ?`). @@ -83,11 +83,11 @@ func TestSelectReturningNoRecords(t *testing.T) { ID int64 `db:"id"` Name string `db:"name"` } - store := must.Return(oblast.NewStore[basicRecord]( + store := oblast.MustNewStore[basicRecord]( oblast.SqliteDialect(), oblast.TableNameIs("basic_records"), oblast.PrimaryKeyIs("id"), - ))(t) + ) t.Run("using Store.Select", func(t *testing.T) { md.ForQuery(`SELECT * FROM basic_records WHERE id < ?`). @@ -130,11 +130,11 @@ func TestSelectIntoUnexpectedField(t *testing.T) { ID int64 `db:"id"` Description string `db:"desc"` // but DB knows only the field "name"! } - store := must.Return(oblast.NewStore[basicRecord]( + store := oblast.MustNewStore[basicRecord]( oblast.SqliteDialect(), oblast.TableNameIs("basic_records"), oblast.PrimaryKeyIs("id"), - ))(t) + ) expectedError := "result has column \"name\" in position 0, but no field in type basicRecord has `db:\"name\"`" @@ -169,11 +169,11 @@ func TestSelectWithScanError(t *testing.T) { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` // but the DB will give us strings that are not timestamps } - store := must.Return(oblast.NewStore[basicRecord]( + store := oblast.MustNewStore[basicRecord]( oblast.SqliteDialect(), oblast.TableNameIs("basic_records"), oblast.PrimaryKeyIs("id"), - ))(t) + ) expectedError := `sql: Scan error on column index 1, name "created_at": unsupported Scan, storing driver.Value type string into type *time.Time` |
