MCPcopy Index your code
hub / github.com/cli/cli / Test_matchesAny

Function Test_matchesAny

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

Source from the content-addressed store, hash-verified

529}
530
531func Test_matchesAny(t *testing.T) {
532 tests := []struct {
533 name string
534 filename string
535 patterns []string
536 want bool
537 }{
538 {
539 name: "exact match",
540 filename: "Makefile",
541 patterns: []string{"Makefile"},
542 want: true,
543 },
544 {
545 name: "glob extension",
546 filename: ".github/workflows/releases.yml",
547 patterns: []string{"*.yml"},
548 want: true,
549 },
550 {
551 name: "no match",
552 filename: "main.go",
553 patterns: []string{"*.yml"},
554 want: false,
555 },
556 {
557 name: "directory glob",
558 filename: ".github/workflows/releases.yml",
559 patterns: []string{".github/*/*"},
560 want: true,
561 },
562 }
563 for _, tt := range tests {
564 t.Run(tt.name, func(t *testing.T) {
565 assert.Equal(t, tt.want, matchesAny(tt.filename, tt.patterns))
566 })
567 }
568}
569
570func Test_sanitizedReader(t *testing.T) {
571 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