Commit 63ca69c
committed
singleflight: Fix TestPanicErrorUnwrap
TestPanicErrorUnwrap does not test what it seems to test
- "wrappedErrorType" is always false (should be true in the second case)
- The values are already wrapped in the private error (they shouldn't)
- "errors.Is(err, new(T))" is undefined for zero-sized "T"s (and false for non-zero-sized).
- "tc := tc" is not needed since Go 1.22
Fixes:
- Use a (local) sentinel value instead of a type, as in TestDoErr.
- Replace all "new(errValue)" by direct references to the unique sentinel "errValue".
- Replace diagnostic, since the error type we get is internal, so we can't directly expect that - it should only wrap our sentinel.
Signed-off-by: Oliver Eikemeier <[email protected]>1 parent 7fad2c9 commit 63ca69c
1 file changed
+7
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 22 | | |
29 | 23 | | |
30 | 24 | | |
| 25 | + | |
| 26 | + | |
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
38 | | - | |
| 34 | + | |
39 | 35 | | |
40 | 36 | | |
41 | 37 | | |
42 | 38 | | |
43 | | - | |
44 | | - | |
| 39 | + | |
| 40 | + | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
48 | 44 | | |
49 | | - | |
50 | | - | |
51 | 45 | | |
52 | 46 | | |
53 | 47 | | |
| |||
75 | 69 | | |
76 | 70 | | |
77 | 71 | | |
78 | | - | |
79 | | - | |
| 72 | + | |
| 73 | + | |
80 | 74 | | |
81 | 75 | | |
82 | 76 | | |
| |||
0 commit comments