(t *testing.T)
| 597 | } |
| 598 | |
| 599 | func Test_matchesAny(t *testing.T) { |
| 600 | tests := []struct { |
| 601 | name string |
| 602 | filename string |
| 603 | patterns []string |
| 604 | want bool |
| 605 | }{ |
| 606 | { |
| 607 | name: "exact match", |
| 608 | filename: "Makefile", |
| 609 | patterns: []string{"Makefile"}, |
| 610 | want: true, |
| 611 | }, |
| 612 | { |
| 613 | name: "glob extension", |
| 614 | filename: ".github/workflows/releases.yml", |
| 615 | patterns: []string{"*.yml"}, |
| 616 | want: true, |
| 617 | }, |
| 618 | { |
| 619 | name: "no match", |
| 620 | filename: "main.go", |
| 621 | patterns: []string{"*.yml"}, |
| 622 | want: false, |
| 623 | }, |
| 624 | { |
| 625 | name: "directory glob", |
| 626 | filename: ".github/workflows/releases.yml", |
| 627 | patterns: []string{".github/*/*"}, |
| 628 | want: true, |
| 629 | }, |
| 630 | } |
| 631 | for _, tt := range tests { |
| 632 | t.Run(tt.name, func(t *testing.T) { |
| 633 | assert.Equal(t, tt.want, matchesAny(tt.filename, tt.patterns)) |
| 634 | }) |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | func Test_sanitizedReader(t *testing.T) { |
| 639 | input := strings.NewReader("\t hello \x1B[m world! ăѣ𝔠ծề\r\n") |
nothing calls this directly
no test coverage detected