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

Function TestDelete

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

Source from the content-addressed store, hash-verified

223}
224
225func TestDelete(t *testing.T) {
226 stool := newStool()
227 db := &DBStub{}
228 r := New(db, "mysql").Bind("test_table", stool)
229
230 if err := r.Delete(); err != nil {
231 t.Errorf("Failed to delete: %s", err)
232 }
233
234 expect := "DELETE FROM test_table WHERE .* AND .*"
235 if ok, _ := regexp.MatchString(expect, db.LastExecSql); !ok {
236 t.Errorf("Unexpect query: %s", db.LastExecSql)
237 }
238 if db.LastExecArgs[0].(int) != 1 {
239 t.Errorf("Expected 1")
240 }
241}
242
243func TestExists(t *testing.T) {
244 stool := newStool()

Callers

nothing calls this directly

Calls 4

newStoolFunction · 0.85
NewFunction · 0.85
BindMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected