MCPcopy Create free account
hub / github.com/Pallinder/go-randomdata / TestPostalCodeFormat

Function TestPostalCodeFormat

postalcodes_test.go:58–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestPostalCodeFormat(t *testing.T) {
59
60 for _, pt := range postalcodeTests {
61 code := PostalCode(pt.Country)
62
63 switch pt.Country {
64 case "GB":
65 matched, err := regexp.MatchString("^\\S{1,2}\\d{1,2} \\d\\S{1,2}", code)
66 if err != nil {
67 t.Errorf("error matching %v", err)
68 }
69
70 if !matched {
71 t.Fatalf("Invalid format for country %q",
72 pt.Country)
73 }
74
75 }
76 }
77}

Callers

nothing calls this directly

Calls 1

PostalCodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…