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

Side by Side Diff: common/sync/parallel/multierror_test.go

Issue 2958433002: [errors] Remove Fix(), move MultiErrorFromErrors(). (Closed)
Patch Set: keep it secret, keep it safe 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 unified diff | Download patch
« no previous file with comments | « common/errors/multierror_test.go ('k') | common/sync/parallel/workPool.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package parallel
6
7 import (
8 "fmt"
9 "testing"
10
11 . "github.com/smartystreets/goconvey/convey"
12 )
13
14 type otherMEType []error
15
16 func (o otherMEType) Error() string { return "FAIL" }
17
18 func TestMultiError(t *testing.T) {
19 t.Parallel()
20
21 Convey("MultiError works", t, func() {
22 Convey("multiErrorFromErrors with errors works", func() {
23 mec := make(chan error, 4)
24 mec <- nil
25 mec <- fmt.Errorf("first error")
26 mec <- nil
27 mec <- fmt.Errorf("what")
28 close(mec)
29
30 err := multiErrorFromErrors(mec)
31 So(err.Error(), ShouldEqual, `first error (and 1 other e rror)`)
32 })
33
34 Convey("multiErrorFromErrors with nil works", func() {
35 So(multiErrorFromErrors(nil), ShouldBeNil)
36
37 c := make(chan error)
38 close(c)
39 So(multiErrorFromErrors(c), ShouldBeNil)
40
41 c = make(chan error, 2)
42 c <- nil
43 c <- nil
44 close(c)
45 So(multiErrorFromErrors(c), ShouldBeNil)
46 })
47 })
48 }
OLDNEW
« no previous file with comments | « common/errors/multierror_test.go ('k') | common/sync/parallel/workPool.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698