Files
dbx/ptr_test.go
T
end 29b855f2b9 test: fill remaining V1 test coverage
Add JSONB, pointer/filter, MustFetchOne, and dialect logger registration
tests for dbxm and dbxp.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 17:51:17 -07:00

27 lines
579 B
Go

package dbx
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPtr_Val(t *testing.T) {
assert.Nil(t, Ptr(""))
assert.Equal(t, Ptr("hi"), Ptr("hi"))
assert.Equal(t, "", Val((*string)(nil)))
assert.Equal(t, "hi", Val(Ptr("hi")))
}
func TestStringToFilter(t *testing.T) {
assert.Equal(t, "%hello%world%", StringToFilter("hello world"))
assert.Equal(t, "%test%", StringToFilter("%test%"))
}
func TestTrimPtr(t *testing.T) {
s := " hello "
assert.Equal(t, "hello", *TrimPtr(&s))
assert.Nil(t, TrimPtr(nil))
assert.Nil(t, TrimPtrToNil(Ptr(" ")))
}