Debian Codegraph @

plumbing/format/gitattributes/matcher_test.go

raw
1 package gitattributes
2
3 import (
4 "strings"
5
6 . "gopkg.in/check.v1"
7 )
8
9 func (s *MatcherSuite) TestMatcher_Match(c *C) {
10 lines := []string{
11 "[attr]binary -diff -merge -text",
12 "**/middle/v[uo]l?ano binary text eol=crlf",
13 "volcano -eol",
14 "foobar diff merge text eol=lf foo=bar",
15 }
16
17 ma, err := ReadAttributes(strings.NewReader(strings.Join(lines, "\n")), nil, true)
18 c.Assert(err, IsNil)
19
20 m := NewMatcher(ma)
21 results, matched := m.Match([]string{"head", "middle", "vulkano"}, nil)
22
23 c.Assert(matched, Equals, true)
24 c.Assert(results["binary"].IsSet(), Equals, true)
25 c.Assert(results["diff"].IsUnset(), Equals, true)
26 c.Assert(results["merge"].IsUnset(), Equals, true)
27 c.Assert(results["text"].IsSet(), Equals, true)
28 c.Assert(results["eol"].Value(), Equals, "crlf")
29 }