| Index: go/src/infra/libs/git/objectType_test.go
|
| diff --git a/go/src/infra/libs/git/objectType_test.go b/go/src/infra/libs/git/objectType_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4f02ef4fc76ebfadd00b5a9782b954fedea4fccc
|
| --- /dev/null
|
| +++ b/go/src/infra/libs/git/objectType_test.go
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package git
|
| +
|
| +import (
|
| + "fmt"
|
| + "testing"
|
| +
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestObjectType(t *testing.T) {
|
| + t.Parallel()
|
| + types := map[string]ObjectType{
|
| + "commit": CommitType,
|
| + "blob": BlobType,
|
| + "tree": TreeType,
|
| + "tag": TagType,
|
| + }
|
| +
|
| + Convey("ObjectType", t, func() {
|
| + Convey("unknown raw value is UNKNOWN", func() {
|
| + So((TagType + 1).String(), ShouldEqual, "UNKNOWN")
|
| + })
|
| +
|
| + for val, expected := range types {
|
| + val, expected := val, expected
|
| + Convey(fmt.Sprintf("MakeObjectType(%#v) == %v", val, expected), func() {
|
| + So(MakeObjectType(val), ShouldEqual, expected)
|
| + })
|
| + }
|
| +
|
| + Convey("MakeObjectType(\"garbage\") panics", func() {
|
| + So(func() { MakeObjectType("garbage") }, ShouldPanic)
|
| + })
|
| + })
|
| +
|
| +}
|
|
|