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

Function TestMainPortOutOfRange

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

Source from the content-addressed store, hash-verified

479}
480
481func TestMainPortOutOfRange(t *testing.T) {
482 log.SetOutput(&bytes.Buffer{})
483
484 err := cmd([]string{
485 "--db",
486 testDbPath,
487 "--query",
488 "SELECT * FROM ip_dns WHERE dns = ?",
489 "--port",
490 "66000",
491 })
492 if err == nil {
493 t.Fatal(`Should throw an error`)
494 }
495 if err == nil || !strings.Contains(err.Error(), "invalid port") {
496 t.Fatalf(`Should throw a "invalid port" error: %v`, err)
497 }
498}
499
500func TestMainInvalidPort(t *testing.T) {
501 os.Stderr = nil

Callers

nothing calls this directly

Calls 1

cmdFunction · 0.85

Tested by

no test coverage detected