fork of go-git with some jj specific features
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

plumbing: format/diff, gocheck to testify migration. Fixes #1282

+23 -20
+23 -20
plumbing/format/diff/unified_encoder_test.go
··· 7 7 "github.com/go-git/go-git/v5/plumbing" 8 8 "github.com/go-git/go-git/v5/plumbing/color" 9 9 "github.com/go-git/go-git/v5/plumbing/filemode" 10 - 11 - . "gopkg.in/check.v1" 10 + "github.com/stretchr/testify/suite" 12 11 ) 13 12 14 - func Test(t *testing.T) { TestingT(t) } 13 + type UnifiedEncoderTestSuite struct { 14 + suite.Suite 15 + } 15 16 16 - type UnifiedEncoderTestSuite struct{} 17 - 18 - var _ = Suite(&UnifiedEncoderTestSuite{}) 17 + func TestUnifiedEncoderTestSuite(t *testing.T) { 18 + suite.Run(t, new(UnifiedEncoderTestSuite)) 19 + } 19 20 20 - func (s *UnifiedEncoderTestSuite) TestBothFilesEmpty(c *C) { 21 + func (s *UnifiedEncoderTestSuite) TestBothFilesEmpty() { 21 22 buffer := bytes.NewBuffer(nil) 22 23 e := NewUnifiedEncoder(buffer, 1) 23 24 err := e.Encode(testPatch{filePatches: []testFilePatch{{}}}) 24 - c.Assert(err, IsNil) 25 + s.NoError(err) 25 26 } 26 27 27 - func (s *UnifiedEncoderTestSuite) TestBinaryFile(c *C) { 28 + func (s *UnifiedEncoderTestSuite) TestBinaryFile() { 28 29 buffer := bytes.NewBuffer(nil) 29 30 e := NewUnifiedEncoder(buffer, 1) 30 31 p := testPatch{ ··· 44 45 } 45 46 46 47 err := e.Encode(p) 47 - c.Assert(err, IsNil) 48 + s.NoError(err) 48 49 49 - c.Assert(buffer.String(), Equals, `diff --git a/binary b/binary 50 + s.Equal(`diff --git a/binary b/binary 50 51 index a459bc245bdbc45e1bca99e7fe61731da5c48da4..6879395eacf3cc7e5634064ccb617ac7aa62be7d 100644 51 52 Binary files a/binary and b/binary differ 52 - `) 53 + `, 54 + buffer.String()) 53 55 } 54 56 55 - func (s *UnifiedEncoderTestSuite) TestCustomSrcDstPrefix(c *C) { 57 + func (s *UnifiedEncoderTestSuite) TestCustomSrcDstPrefix() { 56 58 buffer := bytes.NewBuffer(nil) 57 59 e := NewUnifiedEncoder(buffer, 1).SetSrcPrefix("source/prefix/").SetDstPrefix("dest/prefix/") 58 60 p := testPatch{ ··· 72 74 } 73 75 74 76 err := e.Encode(p) 75 - c.Assert(err, IsNil) 77 + s.NoError(err) 76 78 77 - c.Assert(buffer.String(), Equals, `diff --git source/prefix/binary dest/prefix/binary 79 + s.Equal(`diff --git source/prefix/binary dest/prefix/binary 78 80 index a459bc245bdbc45e1bca99e7fe61731da5c48da4..6879395eacf3cc7e5634064ccb617ac7aa62be7d 100644 79 81 Binary files source/prefix/binary and dest/prefix/binary differ 80 - `) 82 + `, 83 + buffer.String()) 81 84 } 82 85 83 - func (s *UnifiedEncoderTestSuite) TestEncode(c *C) { 86 + func (s *UnifiedEncoderTestSuite) TestEncode() { 84 87 for _, f := range fixtures { 85 - c.Log("executing: ", f.desc) 88 + s.T().Log("executing: ", f.desc) 86 89 87 90 buffer := bytes.NewBuffer(nil) 88 91 e := NewUnifiedEncoder(buffer, f.context).SetColor(f.color) 89 92 90 93 err := e.Encode(f.patch) 91 - c.Assert(err, IsNil) 94 + s.NoError(err) 92 95 93 - c.Assert(buffer.String(), Equals, f.diff) 96 + s.Equal(f.diff, buffer.String()) 94 97 } 95 98 } 96 99