| OLD | NEW |
| 1 package gitinfo | 1 package gitinfo |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "path/filepath" | 4 "path/filepath" |
| 5 "testing" | 5 "testing" |
| 6 "time" | 6 "time" |
| 7 | 7 |
| 8 "skia.googlesource.com/buildbot.git/go/util" | 8 "skia.googlesource.com/buildbot.git/go/util" |
| 9 ) | 9 ) |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 length: 1, | 74 length: 1, |
| 75 }, | 75 }, |
| 76 { | 76 { |
| 77 ts: 1406721641, | 77 ts: 1406721641, |
| 78 length: 2, | 78 length: 2, |
| 79 }, | 79 }, |
| 80 } | 80 } |
| 81 for _, tc := range testCases { | 81 for _, tc := range testCases { |
| 82 hashes := r.From(time.Unix(tc.ts, 0)) | 82 hashes := r.From(time.Unix(tc.ts, 0)) |
| 83 if got, want := len(hashes), tc.length; got != want { | 83 if got, want := len(hashes), tc.length; got != want { |
| 84 » » » t.Errorf("For ts: %d Length returned is wrong: Got %s Wa
nt %d", tc.ts, got, want) | 84 » » » t.Errorf("For ts: %d Length returned is wrong: Got %d Wa
nt %d", tc.ts, got, want) |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 func TestLog(t *testing.T) { | 89 func TestLog(t *testing.T) { |
| 90 tr := util.NewTempRepo() | 90 tr := util.NewTempRepo() |
| 91 defer tr.Cleanup() | 91 defer tr.Cleanup() |
| 92 | 92 |
| 93 r, err := NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false, false) | 93 r, err := NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false, false) |
| 94 if err != nil { | 94 if err != nil { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 r, err := NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false, false) | 233 r, err := NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false, false) |
| 234 if err != nil { | 234 if err != nil { |
| 235 t.Fatal(err) | 235 t.Fatal(err) |
| 236 } | 236 } |
| 237 | 237 |
| 238 if got, want := r.NumCommits(), 2; got != want { | 238 if got, want := r.NumCommits(), 2; got != want { |
| 239 t.Errorf("NumCommit wrong number: Got %v Want %v", got, want) | 239 t.Errorf("NumCommit wrong number: Got %v Want %v", got, want) |
| 240 } | 240 } |
| 241 } | 241 } |
| OLD | NEW |