File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,36 @@ func TestFinish(t *testing.T) {
3939 assert .Nil (t , err )
4040}
4141
42+ func TestFinishWithPartialErrors (t * testing.T ) {
43+ defer goleak .VerifyNone (t )
44+
45+ errDummy := errors .New ("dummy" )
46+
47+ t .Run ("one error" , func (t * testing.T ) {
48+ err := Finish (func () error {
49+ return errDummy
50+ }, func () error {
51+ return nil
52+ }, func () error {
53+ return nil
54+ })
55+
56+ assert .Equal (t , errDummy , err )
57+ })
58+
59+ t .Run ("two errors" , func (t * testing.T ) {
60+ err := Finish (func () error {
61+ return errDummy
62+ }, func () error {
63+ return errDummy
64+ }, func () error {
65+ return nil
66+ })
67+
68+ assert .Equal (t , errDummy , err )
69+ })
70+ }
71+
4272func TestFinishNone (t * testing.T ) {
4373 defer goleak .VerifyNone (t )
4474
You can’t perform that action at this time.
0 commit comments