(t *testing.T)
| 333 | } |
| 334 | |
| 335 | func TestValidateName(t *testing.T) { |
| 336 | tests := []struct { |
| 337 | name string |
| 338 | input string |
| 339 | want bool |
| 340 | }{ |
| 341 | {name: "empty", input: "", want: false}, |
| 342 | {name: "too long", input: strings.Repeat("a", 65), want: false}, |
| 343 | {name: "max length is valid", input: strings.Repeat("a", 64), want: true}, |
| 344 | {name: "contains slash", input: "foo/bar", want: false}, |
| 345 | {name: "contains dotdot", input: "foo..bar", want: false}, |
| 346 | {name: "starts with dot", input: ".hidden", want: false}, |
| 347 | {name: "simple name", input: "code-review", want: true}, |
| 348 | {name: "with dots and underscores", input: "octocat_helper.v2", want: true}, |
| 349 | {name: "uppercase allowed", input: "Octocat", want: true}, |
| 350 | {name: "single char", input: "a", want: true}, |
| 351 | } |
| 352 | for _, tt := range tests { |
| 353 | t.Run(tt.name, func(t *testing.T) { |
| 354 | assert.Equal(t, tt.want, validateName(tt.input)) |
| 355 | }) |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | func TestIsSpecCompliant(t *testing.T) { |
| 360 | tests := []struct { |
nothing calls this directly
no test coverage detected