MCPcopy
hub / github.com/segmentio/ksuid / TestSqlScanner

Function TestSqlScanner

ksuid_test.go:212–240  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

210}
211
212func TestSqlScanner(t *testing.T) {
213 id1 := New()
214 id2 := New()
215
216 tests := []struct {
217 ksuid KSUID
218 value interface{}
219 }{
220 {Nil, nil},
221 {id1, id1.String()},
222 {id2, id2.Bytes()},
223 }
224
225 for _, test := range tests {
226 t.Run(fmt.Sprintf("%T", test.value), func(t *testing.T) {
227 var id KSUID
228
229 if err := id.Scan(test.value); err != nil {
230 t.Error(err)
231 }
232
233 if id != test.ksuid {
234 t.Error("bad KSUID:")
235 t.Logf("expected %v", test.ksuid)
236 t.Logf("found %v", id)
237 }
238 })
239 }
240}
241
242func TestAppend(t *testing.T) {
243 for _, repr := range []string{"0pN1Own7255s7jwpwy495bAZeEa", "aWgEPTl1tmebfsQzFP4bxwgy80V"} {

Callers

nothing calls this directly

Calls 4

ScanMethod · 0.95
NewFunction · 0.85
BytesMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…