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

Function TestMainInvalidQuery

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

Source from the content-addressed store, hash-verified

517}
518
519func TestMainInvalidQuery(t *testing.T) {
520 os.Stderr = nil
521
522 err := cmd([]string{
523 "--db",
524 testDbPath,
525 "--query",
526 "BANANA * FROM ip_dns WHERE dns = ?",
527 })
528 if err == nil {
529 t.Fatal(`Should throw an error`)
530 }
531 if err == nil || !strings.Contains(err.Error(), "syntax error") {
532 t.Fatalf(`Should throw a 'syntax error' error: %v`, err)
533 }
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))

Callers

nothing calls this directly

Calls 1

cmdFunction · 0.85

Tested by

no test coverage detected