aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/gitignore/matcher_test.go
blob: 268e1c048d45325305b4b710d33bd4aeef92266c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package gitignore

import "testing"

func TestMatcher_Match(t *testing.T) {
	ps := []Pattern{
		ParsePattern("**/middle/v[uo]l?ano", nil),
		ParsePattern("!volcano", nil),
	}
	m := NewMatcher(ps)
	if !m.Match([]string{"head", "middle", "vulkano"}, false) {
		t.Errorf("expected a match, found mismatch")
	}
	if m.Match([]string{"head", "middle", "volcano"}, false) {
		t.Errorf("expected a mismatch, found a match")
	}
}