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

Function TestMainInvalidPort

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

Source from the content-addressed store, hash-verified

498}
499
500func TestMainInvalidPort(t *testing.T) {
501 os.Stderr = nil
502
503 err := cmd([]string{
504 "--db",
505 testDbPath,
506 "--query",
507 "SELECT * FROM ip_dns WHERE dns = ?",
508 "--port",
509 "-1",
510 })
511 if err == nil {
512 t.Fatal(`Should throw an error`)
513 }
514 if err == nil || !strings.Contains(err.Error(), `invalid value "-1" for flag -port: parse error`) {
515 t.Fatalf(`Should throw a 'invalid value "-1" for flag -port: parse error' error: %v`, err)
516 }
517}
518
519func TestMainInvalidQuery(t *testing.T) {
520 os.Stderr = nil

Callers

nothing calls this directly

Calls 1

cmdFunction · 0.85

Tested by

no test coverage detected