MCPcopy Create free account
hub / github.com/cli/cli / Test_matchesAny

Function Test_matchesAny

pkg/cmd/pr/diff/diff_test.go:599–636  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

597}
598
599func 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
638func Test_sanitizedReader(t *testing.T) {
639 input := strings.NewReader("\t hello \x1B[m world! ăѣ𝔠ծề\r\n")

Callers

nothing calls this directly

Calls 3

matchesAnyFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected