@@ -2,6 +2,7 @@ package index
2
2
3
3
import (
4
4
"bytes"
5
+ "path/filepath"
5
6
"testing"
6
7
7
8
. "gopkg.in/check.v1"
@@ -43,15 +44,17 @@ func (s *NoderSuite) TestDiff(c *C) {
43
44
44
45
func (s * NoderSuite ) TestDiffChange (c * C ) {
45
46
indexA := & index.Index {
46
- Entries : []* index.Entry {
47
- {Name : "bar/baz/bar" , Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" )},
48
- },
47
+ Entries : []* index.Entry {{
48
+ Name : filepath .Join ("bar" , "baz" , "bar" ),
49
+ Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
50
+ }},
49
51
}
50
52
51
53
indexB := & index.Index {
52
- Entries : []* index.Entry {
53
- {Name : "bar/baz/foo" , Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" )},
54
- },
54
+ Entries : []* index.Entry {{
55
+ Name : filepath .Join ("bar" , "baz" , "foo" ),
56
+ Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
57
+ }},
55
58
}
56
59
57
60
ch , err := merkletrie .DiffTree (NewRootNode (indexA ), NewRootNode (indexB ), isEquals )
@@ -61,15 +64,17 @@ func (s *NoderSuite) TestDiffChange(c *C) {
61
64
62
65
func (s * NoderSuite ) TestDiffDir (c * C ) {
63
66
indexA := & index.Index {
64
- Entries : []* index.Entry {
65
- {Name : "foo" , Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" )},
66
- },
67
+ Entries : []* index.Entry {{
68
+ Name : "foo" ,
69
+ Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
70
+ }},
67
71
}
68
72
69
73
indexB := & index.Index {
70
- Entries : []* index.Entry {
71
- {Name : "foo/bar" , Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" )},
72
- },
74
+ Entries : []* index.Entry {{
75
+ Name : filepath .Join ("foo" , "bar" ),
76
+ Hash : plumbing .NewHash ("8ab686eafeb1f44702738c8b0f24f2567c36da6d" ),
77
+ }},
73
78
}
74
79
75
80
ch , err := merkletrie .DiffTree (NewRootNode (indexA ), NewRootNode (indexB ), isEquals )
0 commit comments