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>
This commit is contained in:
2026-06-29 17:51:17 -07:00
parent 7647884464
commit 29b855f2b9
5 changed files with 121 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
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(" ")))
}