| Index: go/src/infra/gae/libs/gae/upstream_errors_test.go
 | 
| diff --git a/go/src/infra/gae/libs/gae/upstream_errors_test.go b/go/src/infra/gae/libs/gae/upstream_errors_test.go
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..a5a2e8276454482ce4eabd22ab326b6ecfafb037
 | 
| --- /dev/null
 | 
| +++ b/go/src/infra/gae/libs/gae/upstream_errors_test.go
 | 
| @@ -0,0 +1,60 @@
 | 
| +// Copyright 2015 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 gae
 | 
| +
 | 
| +import (
 | 
| +	"errors"
 | 
| +	"testing"
 | 
| +
 | 
| +	. "github.com/smartystreets/goconvey/convey"
 | 
| +)
 | 
| +
 | 
| +type otherMEType []error
 | 
| +
 | 
| +func (o otherMEType) Error() string { return "FAIL" }
 | 
| +
 | 
| +func TestUpstreamErrors(t *testing.T) {
 | 
| +	t.Parallel()
 | 
| +
 | 
| +	Convey("Test MultiError", t, func() {
 | 
| +		Convey("nil", func() {
 | 
| +			me := MultiError(nil)
 | 
| +			So(me.Error(), ShouldEqual, "(0 errors)")
 | 
| +			Convey("single", func() {
 | 
| +				So(SingleError(error(me)), ShouldBeNil)
 | 
| +			})
 | 
| +		})
 | 
| +		Convey("one", func() {
 | 
| +			me := MultiError{errors.New("sup")}
 | 
| +			So(me.Error(), ShouldEqual, "sup")
 | 
| +		})
 | 
| +		Convey("two", func() {
 | 
| +			me := MultiError{errors.New("sup"), errors.New("what")}
 | 
| +			So(me.Error(), ShouldEqual, "sup (and 1 other error)")
 | 
| +		})
 | 
| +		Convey("more", func() {
 | 
| +			me := MultiError{errors.New("sup"), errors.New("what"), errors.New("nerds")}
 | 
| +			So(me.Error(), ShouldEqual, "sup (and 2 other errors)")
 | 
| +
 | 
| +			Convey("single", func() {
 | 
| +				So(SingleError(error(me)), ShouldResemble, errors.New("sup"))
 | 
| +			})
 | 
| +		})
 | 
| +		Convey("convert", func() {
 | 
| +			ome := otherMEType{errors.New("sup")}
 | 
| +			So(FixError(ome), ShouldHaveSameTypeAs, MultiError{})
 | 
| +		})
 | 
| +	})
 | 
| +
 | 
| +	Convey("FixError passes through", t, func() {
 | 
| +		e := errors.New("unique")
 | 
| +		So(FixError(e), ShouldEqual, e)
 | 
| +	})
 | 
| +
 | 
| +	Convey("SingleError passes through", t, func() {
 | 
| +		e := errors.New("unique")
 | 
| +		So(SingleError(e), ShouldEqual, e)
 | 
| +	})
 | 
| +}
 | 
| 
 |