| 69 | } |
| 70 | |
| 71 | func TestCanceledError(t *testing.T) { |
| 72 | e := CanceledError{} |
| 73 | if e.Error() != "transition canceled" { |
| 74 | t.Error("CanceledError string mismatch") |
| 75 | } |
| 76 | e.Err = errors.New("canceled") |
| 77 | if e.Error() != "transition canceled with error: "+e.Err.Error() { |
| 78 | t.Error("CanceledError string mismatch") |
| 79 | } |
| 80 | if e.Unwrap() == nil { |
| 81 | t.Error("CanceledError Unwrap() should not be nil") |
| 82 | } |
| 83 | if !errors.Is(e, e.Err) { |
| 84 | t.Error("CanceledError should be equal to its error") |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | func TestAsyncError(t *testing.T) { |
| 89 | e := AsyncError{} |