MCPcopy
hub / github.com/jmoiron/sqlx / TestBasic

Function TestBasic

reflectx/reflect_test.go:13–36  ·  reflectx/reflect_test.go::TestBasic
(t *testing.T)

Source from the content-addressed store, hash-verified

11}
12
13func TestBasic(t *testing.T) {
14 type Foo struct {
15 A int
16 B int
17 C int
18 }
19
20 f := Foo{1, 2, 3}
21 fv := reflect.ValueOf(f)
22 m := NewMapperFunc("", func(s string) string { return s })
23
24 v := m.FieldByName(fv, "A")
25 if ival(v) != f.A {
26 t.Errorf("Expecting %d, got %d", ival(v), f.A)
27 }
28 v = m.FieldByName(fv, "B")
29 if ival(v) != f.B {
30 t.Errorf("Expecting %d, got %d", f.B, ival(v))
31 }
32 v = m.FieldByName(fv, "C")
33 if ival(v) != f.C {
34 t.Errorf("Expecting %d, got %d", f.C, ival(v))
35 }
36}
37
38func TestBasicEmbedded(t *testing.T) {
39 type Foo struct {

Callers

nothing calls this directly

Calls 4

NewMapperFuncFunction · 0.85
ivalFunction · 0.85
FieldByNameMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected