@@ -10,35 +10,45 @@ import (
10
10
11
11
func TestJoin (t * testing.T ) {
12
12
for _ , tt := range []struct {
13
- err * joinError
14
- iss []error
15
- ass []interface {}
16
- s string
13
+ join error
14
+ iss []error
15
+ ass []interface {}
16
+ s string
17
17
}{
18
18
{
19
- err : Join (context .Canceled ),
20
- iss : []error {context .Canceled },
21
- ass : nil ,
22
- s : "[ \" context canceled\" ] " ,
19
+ join : Join (context .Canceled ),
20
+ iss : []error {context .Canceled },
21
+ ass : nil ,
22
+ s : " context canceled" ,
23
23
},
24
24
{
25
- err : Join (context .Canceled , context .DeadlineExceeded , Operation ()),
26
- iss : []error {context .Canceled , context .DeadlineExceeded },
25
+ join : Join (context .Canceled , context .DeadlineExceeded , Operation ()),
26
+ iss : []error {context .Canceled , context .DeadlineExceeded },
27
27
ass : []interface {}{func () interface {} {
28
28
var i isYdbError
29
29
30
30
return & i
31
31
}()},
32
32
s : "[\" context canceled\" ,\" context deadline exceeded\" ,\" operation/STATUS_CODE_UNSPECIFIED (code = 0)\" ]" ,
33
33
},
34
+ {
35
+ join : Join (context .Canceled , context .DeadlineExceeded , nil ),
36
+ iss : []error {context .Canceled , context .DeadlineExceeded },
37
+ s : "[\" context canceled\" ,\" context deadline exceeded\" ]" ,
38
+ },
39
+ {
40
+ join : Join (nil , context .DeadlineExceeded , nil ),
41
+ iss : []error {context .DeadlineExceeded },
42
+ s : "context deadline exceeded" ,
43
+ },
34
44
} {
35
45
t .Run ("" , func (t * testing.T ) {
36
- require .Equal (t , tt .s , tt .err .Error ())
46
+ require .Equal (t , tt .s , tt .join .Error ())
37
47
if len (tt .iss ) > 0 {
38
- require .True (t , Is (tt .err , tt .iss ... ))
48
+ require .True (t , Is (tt .join , tt .iss ... ))
39
49
}
40
50
if len (tt .ass ) > 0 {
41
- require .True (t , As (tt .err , tt .ass ... ))
51
+ require .True (t , As (tt .join , tt .ass ... ))
42
52
}
43
53
})
44
54
}
@@ -48,7 +58,7 @@ func TestUnwrapJoined(t *testing.T) {
48
58
err1 := context .Canceled
49
59
err2 := context .DeadlineExceeded
50
60
51
- var joined error = Join (err1 , err2 )
61
+ joined : = Join (err1 , err2 )
52
62
53
63
unwrappable := joined .(interface { Unwrap () []error }) //nolint:errorlint
54
64
inners := unwrappable .Unwrap ()
0 commit comments