| 40 | } |
| 41 | |
| 42 | func 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 | |
| 52 | func TestExample(t *testing.T) { |
| 53 | cases := []struct { |