aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/git/git_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-04-24 13:12:40 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-04-24 13:23:01 +0200
commit9366d03f001170479319878905031f63d4377c46 (patch)
tree6d9c06b2fffb9e29f81b8b746e218e2db914aa3b /pkg/git/git_test.go
parente2f4bf8f3818d49baf0f3789add75d5fd506ad8d (diff)
dashboard/app: allow testing fixes on exact commit and without patch
This implements 2 features: 1. It's now possible to specify exact commit when testing as: 2. It's possible to test without patch attached assuming the patch is already committed to the tested tree. Fixes #558
Diffstat (limited to 'pkg/git/git_test.go')
-rw-r--r--pkg/git/git_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go
index 8e23e84b2..7ad42e3dc 100644
--- a/pkg/git/git_test.go
+++ b/pkg/git/git_test.go
@@ -66,6 +66,7 @@ func TestCheckBranch(t *testing.T) {
{"linux-4.9.y", true},
{"abi_spec", true},
{"@", false},
+ {"", false},
}
for _, test := range tests {
res := CheckBranch(test.branch)
@@ -75,6 +76,30 @@ func TestCheckBranch(t *testing.T) {
}
}
+func TestCheckCommitHash(t *testing.T) {
+ var tests = []struct {
+ hash string
+ result bool
+ }{
+ {"ff12bea91c22bba93d3ffc3034d813d686bc7eeb", true}, // 40
+ {"eae05cb0aaeae05cb0aa", true}, // 20
+ {"449dd6984d0eaabb", true}, // 16
+ {"449dd6984d0e", true}, // 12
+ {"eae05cb0aa", true}, // 10
+ {"eae05cb0", true}, // 8
+ {"", false},
+ {"aa", false},
+ {"eae05cb0aab", false},
+ {"xxxxxxxx", false},
+ }
+ for _, test := range tests {
+ res := CheckCommitHash(test.hash)
+ if res != test.result {
+ t.Errorf("%v: got %v, want %v", test.hash, res, test.result)
+ }
+ }
+}
+
func TestExtractFixTags(t *testing.T) {
commits, err := extractFixTags(strings.NewReader(extractFixTagsInput), extractFixTagsEmail)
if err != nil {