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

Function TestMainDbFileNotThere

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

Source from the content-addressed store, hash-verified

434}
435
436func TestMainDbFileNotThere(t *testing.T) {
437 err := cmd([]string{
438 "--db",
439 "blabla",
440 "--query",
441 "SELECT * FROM ip_dns WHERE dns = ?",
442 })
443 if err == nil {
444 t.Fatal(`Should throw an error`)
445 }
446 if !strings.Contains(err.Error(), "Database file 'blabla' doesn't exist") {
447 t.Fatalf(`Should throw a file doesn't exist error: %v`, err)
448 }
449}
450
451func TestMainEmptyDbParam(t *testing.T) {
452 log.SetOutput(&bytes.Buffer{})

Callers

nothing calls this directly

Calls 1

cmdFunction · 0.85

Tested by

no test coverage detected