/
githubmirror
/
ydb-go-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-go-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
internal/xsql/context_test.go
38 строк
858 B
Copilot
Add unit tests for internal/xsql package to increase test coverage (#1895)
24 окт 2025, 13:17
Не верифицирован
24 окт 2025, 13:17
fda5a9d
Код
Авторство
О чём код?
package xsql import ( "context" "testing" "github.com/stretchr/testify/require" ) func TestWithExplain(t *testing.T) { ctx := context.Background() require.False(t, isExplain(ctx)) ctx = WithExplain(ctx) require.True(t, isExplain(ctx)) } func TestIsExplain(t *testing.T) { t.Run("NoValue", func(t *testing.T) { ctx := context.Background() require.False(t, isExplain(ctx)) }) t.Run("WithValue", func(t *testing.T) { ctx := WithExplain(context.Background()) require.True(t, isExplain(ctx)) }) t.Run("WithFalseValue", func(t *testing.T) { ctx := context.WithValue(context.Background(), ctxExplainQueryModeKey{}, false) require.False(t, isExplain(ctx)) }) t.Run("WithWrongTypeValue", func(t *testing.T) { ctx := context.WithValue(context.Background(), ctxExplainQueryModeKey{}, "true") require.False(t, isExplain(ctx)) }) }