diff options
author | Arne Westphal <arne.westphal@siemens.com> | 2020-06-29 21:21:42 +0200 |
---|---|---|
committer | Arne Westphal <arne.westphal@siemens.com> | 2020-06-29 21:22:45 +0200 |
commit | ea6427055f718bc8d2f515b9535e62744247fe0d (patch) | |
tree | f16b041d1de5f07e8b3ca7ccba24af1d707e659b /plumbing/format/gitignore | |
parent | 6ac8c9f15d6854b0b9a8e8b95dc17104f68680ce (diff) | |
download | go-git-ea6427055f718bc8d2f515b9535e62744247fe0d.tar.gz |
test CRLF in GFS case
Diffstat (limited to 'plumbing/format/gitignore')
-rw-r--r-- | plumbing/format/gitignore/dir_test.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plumbing/format/gitignore/dir_test.go b/plumbing/format/gitignore/dir_test.go index c0301f7..1aa8a64 100644 --- a/plumbing/format/gitignore/dir_test.go +++ b/plumbing/format/gitignore/dir_test.go @@ -29,6 +29,8 @@ func (s *MatcherSuite) SetUpTest(c *C) { c.Assert(err, IsNil) _, err = f.Write([]byte("vendor/g*/\n")) c.Assert(err, IsNil) + _, err = f.Write([]byte("ignore.crlf\r\n")) + c.Assert(err, IsNil) err = f.Close() c.Assert(err, IsNil) @@ -41,9 +43,14 @@ func (s *MatcherSuite) SetUpTest(c *C) { err = f.Close() c.Assert(err, IsNil) - fs.MkdirAll("another", os.ModePerm) - fs.MkdirAll("vendor/github.com", os.ModePerm) - fs.MkdirAll("vendor/gopkg.in", os.ModePerm) + err = fs.MkdirAll("another", os.ModePerm) + c.Assert(err, IsNil) + err = fs.MkdirAll("ignore.crlf", os.ModePerm) + c.Assert(err, IsNil) + err = fs.MkdirAll("vendor/github.com", os.ModePerm) + c.Assert(err, IsNil) + err = fs.MkdirAll("vendor/gopkg.in", os.ModePerm) + c.Assert(err, IsNil) s.GFS = fs @@ -167,9 +174,10 @@ func (s *MatcherSuite) SetUpTest(c *C) { func (s *MatcherSuite) TestDir_ReadPatterns(c *C) { ps, err := ReadPatterns(s.GFS, nil) c.Assert(err, IsNil) - c.Assert(ps, HasLen, 2) + c.Assert(ps, HasLen, 3) m := NewMatcher(ps) + c.Assert(m.Match([]string{"ignore.crlf"}, true), Equals, true) c.Assert(m.Match([]string{"vendor", "gopkg.in"}, true), Equals, true) c.Assert(m.Match([]string{"vendor", "github.com"}, true), Equals, false) } |