MCPcopy Create free account
hub / github.com/goadesign/goa / TestByFormatUUID

Function TestByFormatUUID

expr/example_test.go:42–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestByFormatUUID(t *testing.T) {
43 val := &expr.ValidationExpr{Format: expr.FormatUUID}
44 att := expr.AttributeExpr{Validation: val}
45 r := expr.NewRandom("test")
46 example := att.Example(r).(string)
47 if !regexp.MustCompile(`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`).MatchString(example) {
48 t.Errorf("got %s, expected a match with `[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`", example)
49 }
50}
51
52func TestExample(t *testing.T) {
53 cases := []struct {

Callers

nothing calls this directly

Calls 2

ExampleMethod · 0.95
NewRandomFunction · 0.92

Tested by

no test coverage detected