MCPcopy Create free account
hub / github.com/Masterminds/semver / TestValidateMetadata

Function TestValidateMetadata

version_test.go:1037–1055  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1035}
1036
1037func TestValidateMetadata(t *testing.T) {
1038 tests := []struct {
1039 meta string
1040 expected error
1041 }{
1042 {"foo", nil},
1043 {"alpha.1", nil},
1044 {"alpha.01", nil},
1045 {"foo☃︎", ErrInvalidMetadata},
1046 {"alpha.0-1", nil},
1047 {"al-pha.1Phe70CgWe050H9K1mJwRUqTNQXZRERwLOEg37wpXUb4JgzgaD5YkL52ABnoyiE", nil},
1048 }
1049
1050 for _, tc := range tests {
1051 if err := validateMetadata(tc.meta); err != tc.expected {
1052 t.Errorf("Unexpected error %q for metadata %q", err, tc.meta)
1053 }
1054 }
1055}
1056
1057func FuzzNewVersion(f *testing.F) {
1058 testcases := []string{"v1.2.3", " ", "......", "1", "1.2.3-beta.1", "1.2.3+foo", "2.3.4-alpha.1+bar", "lorem ipsum"}

Callers

nothing calls this directly

Calls 1

validateMetadataFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…