MCPcopy Index your code
hub / github.com/Masterminds/structable / TestBind

Function TestBind

structable_test.go:55–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestBind(t *testing.T) {
56 store := new(DbRecorder)
57
58 stool := newStool()
59 store.Bind("test_table", stool)
60
61 if store.table != "test_table" {
62 t.Errorf("Failed to get table name.")
63 }
64
65 if len(store.fields) != 5 {
66 t.Errorf("Expected 5 fields, got %d: %+v", len(store.fields), store.fields)
67 }
68
69 keyCount := 0
70 for _, f := range store.fields {
71 if f.isKey {
72 keyCount++
73 }
74 }
75
76 if keyCount != 2 {
77 t.Errorf("Expected two keys.")
78 }
79
80 if len(store.Key()) != 2 {
81 t.Errorf("Wrong number of keys.")
82 }
83}
84
85func TestLoad(t *testing.T) {
86 stool := newStool()

Callers

nothing calls this directly

Calls 3

newStoolFunction · 0.85
KeyMethod · 0.80
BindMethod · 0.65

Tested by

no test coverage detected