@@ -8,26 +8,53 @@ type CommitWalkerSuite struct {
8
8
9
9
var _ = Suite (& CommitWalkerSuite {})
10
10
11
- func (s * CommitWalkerSuite ) TestWalkerNext (c * C ) {
11
+ func (s * CommitWalkerSuite ) TestWalkHistory (c * C ) {
12
12
commit := s .commit (c , s .Fixture .Head )
13
13
14
14
var commits []* Commit
15
-
16
15
WalkCommitHistory (commit , func (c * Commit ) error {
17
16
commits = append (commits , c )
18
17
return nil
19
18
})
20
19
21
- SortCommits (commits )
22
20
c .Assert (commits , HasLen , 8 )
23
21
24
22
expected := []string {
25
- "b029517f6300c2da0f4b651b8642506cd6aaf45d" , "b8e471f58bcbca63b07bda20e428190409c2db47" ,
26
- "35e85108805c84807bc66a02d91535e1e24b38b9" , "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69" ,
27
- "1669dce138d9b841a518c64b10914d88f5e488ea" , "af2d6a6954d532f8ffb47615169c8fdf9d383a1a" ,
28
- "918c48b83bd081e863dbe1b80f8998f058cd8294" , "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ,
23
+ "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ,
24
+ "918c48b83bd081e863dbe1b80f8998f058cd8294" ,
25
+ "af2d6a6954d532f8ffb47615169c8fdf9d383a1a" ,
26
+ "1669dce138d9b841a518c64b10914d88f5e488ea" ,
27
+ "35e85108805c84807bc66a02d91535e1e24b38b9" ,
28
+ "b029517f6300c2da0f4b651b8642506cd6aaf45d" ,
29
+ "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69" ,
30
+ "b8e471f58bcbca63b07bda20e428190409c2db47" ,
31
+ }
32
+ for i , commit := range commits {
33
+ c .Assert (commit .Hash .String (), Equals , expected [i ])
29
34
}
35
+ }
36
+
37
+ func (s * CommitWalkerSuite ) TestWalkHistoryPost (c * C ) {
38
+ commit := s .commit (c , s .Fixture .Head )
39
+
40
+ var commits []* Commit
41
+ WalkCommitHistoryPost (commit , func (c * Commit ) error {
42
+ commits = append (commits , c )
43
+ return nil
44
+ })
30
45
46
+ c .Assert (commits , HasLen , 8 )
47
+
48
+ expected := []string {
49
+ "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ,
50
+ "918c48b83bd081e863dbe1b80f8998f058cd8294" ,
51
+ "af2d6a6954d532f8ffb47615169c8fdf9d383a1a" ,
52
+ "1669dce138d9b841a518c64b10914d88f5e488ea" ,
53
+ "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69" ,
54
+ "b8e471f58bcbca63b07bda20e428190409c2db47" ,
55
+ "b029517f6300c2da0f4b651b8642506cd6aaf45d" ,
56
+ "35e85108805c84807bc66a02d91535e1e24b38b9" ,
57
+ }
31
58
for i , commit := range commits {
32
59
c .Assert (commit .Hash .String (), Equals , expected [i ])
33
60
}
0 commit comments