Skip to content

Commit

Permalink
fix param tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby committed Oct 17, 2024
1 parent 2199911 commit b648513
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions internal/bind/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/require"

"github.com/ydb-platform/ydb-go-sdk/v3/internal/params"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
"github.com/ydb-platform/ydb-go-sdk/v3/table"
"github.com/ydb-platform/ydb-go-sdk/v3/table/types"
)
Expand Down Expand Up @@ -283,17 +285,33 @@ func TestToValue(t *testing.T) {
dst: types.UUIDValue([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}), //nolint:staticcheck
err: nil,
},
{
src: func() *[16]byte { return nil }(),
dst: types.NullValue(types.TypeUUID),
err: nil,
},
{
src: func(v [16]byte) *[16]byte { return &v }([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}),
dst: types.OptionalValue(types.UUIDValue([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})), //nolint:staticcheck,lll
err: nil,
},
{
src: func() *[16]byte { return nil }(),
dst: types.NullValue(types.TypeUUID),
src: uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
dst: value.TextValue("01020304-0506-0708-090a-0b0c0d0e0f10"), //nolint:staticcheck

Check failure on line 300 in internal/bind/params_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

directive `//nolint:staticcheck` is unused for linter "staticcheck" (nolintlint)
err: nil,
},

{
src: func(v uuid.UUID) *uuid.UUID { return &v }(uuid.UUID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}),
// uuid implemented driver.Valuer and doesn't set optional wrapper
dst: types.TextValue("01020304-0506-0708-090a-0b0c0d0e0f10"), //nolint:staticcheck,lll

Check failure on line 306 in internal/bind/params_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

directive `//nolint:staticcheck,lll` is unused for linter "staticcheck" (nolintlint)
err: nil,
},
// https://github.com/ydb-platform/ydb-go-sdk/issues/1515
//{
// src: func() *uuid.UUID { return nil }(),
// dst: nil,
// err: nil,
//},
{
src: time.Unix(42, 43),
dst: types.TimestampValueFromTime(time.Unix(42, 43)),
Expand Down

0 comments on commit b648513

Please sign in to comment.