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

Function TestDoNotPanicOnConnect

sqlx_test.go:1308–1316  ·  view source on GitHub ↗

tests that sqlx will not panic when the wrong driver is passed because of an automatic nil dereference in sqlx.Open(), which was fixed.

(t *testing.T)

Source from the content-addressed store, hash-verified

1306// tests that sqlx will not panic when the wrong driver is passed because
1307// of an automatic nil dereference in sqlx.Open(), which was fixed.
1308func TestDoNotPanicOnConnect(t *testing.T) {
1309 db, err := Connect("bogus", "hehe")
1310 if err == nil {
1311 t.Errorf("Should return error when using bogus driverName")
1312 }
1313 if db != nil {
1314 t.Errorf("Should not return the db on a connect failure")
1315 }
1316}
1317
1318func TestRebind(t *testing.T) {
1319 q1 := `INSERT INTO foo (a, b, c, d, e, f, g, h, i) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`

Callers

nothing calls this directly

Calls 2

ConnectFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected