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

Unified Diff: common/errors/multierror_test.go

Issue 2958433002: [errors] Remove Fix(), move MultiErrorFromErrors(). (Closed)
Patch Set: Created 3 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: common/errors/multierror_test.go
diff --git a/common/errors/multierror_test.go b/common/errors/multierror_test.go
index 5d1363d03dcdaf806b2db67ed9520a1a219cec25..645bb18b1b5bd23fad49dc550948de0386b3b0c0 100644
--- a/common/errors/multierror_test.go
+++ b/common/errors/multierror_test.go
@@ -23,32 +23,6 @@ func TestMultiError(t *testing.T) {
var me error = MultiError{fmt.Errorf("hello"), fmt.Errorf("bob")}
So(me.Error(), ShouldEqual, `hello (and 1 other error)`)
-
- Convey("MultiErrorFromErrors with errors works", func() {
- mec := make(chan error, 4)
- mec <- nil
- mec <- fmt.Errorf("first error")
- mec <- nil
- mec <- fmt.Errorf("what")
- close(mec)
-
- err := MultiErrorFromErrors(mec)
- So(err.Error(), ShouldEqual, `first error (and 1 other error)`)
- })
-
- Convey("MultiErrorFromErrors with nil works", func() {
- So(MultiErrorFromErrors(nil), ShouldBeNil)
-
- c := make(chan error)
- close(c)
- So(MultiErrorFromErrors(c), ShouldBeNil)
-
- c = make(chan error, 2)
- c <- nil
- c <- nil
- close(c)
- So(MultiErrorFromErrors(c), ShouldBeNil)
- })
})
}
@@ -85,35 +59,4 @@ func TestUpstreamErrors(t *testing.T) {
e := errors.New("unique")
So(SingleError(e), ShouldEqual, e)
})
-
- Convey("Test MultiError Conversion", t, func() {
- ome := otherMEType{errors.New("sup")}
- So(Fix(ome), ShouldHaveSameTypeAs, MultiError{})
- })
-
- Convey("Fix passes through", t, func() {
- e := errors.New("unique")
- So(Fix(e), ShouldEqual, e)
- })
-}
-
-func ExampleMultiError() {
- errCh := make(chan error, 10)
- errCh <- nil // nils are ignored
- errCh <- fmt.Errorf("what")
- close(errCh)
-
- err := MultiErrorFromErrors(errCh)
- fmt.Printf("got: %s len=%d\n", err, len(err.(MultiError)))
-
- errCh = make(chan error, 10)
- errCh <- nil // and if the channel only has nils
- close(errCh)
-
- err = MultiErrorFromErrors(errCh) // then it returns nil
- fmt.Printf("got: %v\n", err)
-
- // Output:
- // got: what len=1
- // got: <nil>
}

Powered by Google App Engine
This is Rietveld 408576698