Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: go/gitinfo/gitinfo_test.go

Issue 777413002: Add new tests to presubmit, fix errors (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « go/gitinfo/gitinfo.go ('k') | go/login/login.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « go/gitinfo/gitinfo.go ('k') | go/login/login.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698