MCPcopy Create free account
hub / github.com/ProspectOne/perfops-cli / TestIsValidTarget

Function TestIsValidTarget

perfops/run_test.go:562–585  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

560}
561
562func TestIsValidTarget(t *testing.T) {
563 testCases := map[string]struct {
564 t string
565 valid bool
566 }{
567 "Empty target": {"", false},
568 "Invalid hostname": {"meep", false},
569 "No TLD": {"meep.", false},
570 "Invalid TLD": {"meep.123", false},
571 "Valid hostname": {"meep.com", true},
572 "Invalid IPv4": {"123.644.123.123", false},
573 "Valid IPv4": {"123.123.123.123", true},
574 "Invalid IPv6": {"123:123", false},
575 "Valid IPv6": {"2001:db8::68", true},
576 }
577 for name, tc := range testCases {
578 t.Run(name, func(t *testing.T) {
579 got := isValidTarget(tc.t)
580 if got != tc.valid {
581 t.Fatalf("expected %v; got %v", tc.valid, got)
582 }
583 })
584 }
585}
586
587func TestIsValidLimit(t *testing.T) {
588 testCases := map[string]struct {

Callers

nothing calls this directly

Calls 1

isValidTargetFunction · 0.85

Tested by

no test coverage detected