MCPcopy Index your code
hub / github.com/assafmo/SQLiteQueryServer / TestCountParamsZero

Function TestCountParamsZero

main_test.go:536–557  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

534}
535
536func TestCountParamsZero(t *testing.T) {
537 db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?mode=rw&cache=shared&_journal_mode=WAL", testDbPath))
538 if err != nil {
539 t.Fatalf("Should open testDbPath (%s) just fine", testDbPath)
540 }
541 defer db.Close()
542
543 db.SetMaxOpenConns(1)
544
545 queryStmt, err := db.Prepare("select * from ip_dns")
546 if err != nil {
547 t.Fatal("Should prepare query just fine")
548 }
549
550 count, err := countParams(queryStmt)
551 if err != nil {
552 t.Fatal("Shouldn't throw an error")
553 }
554 if count != 0 {
555 t.Fatal("should return 0")
556 }
557}
558
559func TestCountParamsNotZero(t *testing.T) {
560 db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?mode=rw&cache=shared&_journal_mode=WAL", testDbPath))

Callers

nothing calls this directly

Calls 1

countParamsFunction · 0.85

Tested by

no test coverage detected