24 lines
527 B
Go
24 lines
527 B
Go
package cc
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestClaudeTimeoutErrorUnwrapsToClaudeError(t *testing.T) {
|
|
err := error(&ClaudeTimeoutError{ClaudeError{Msg: "timeout", Stderr: "boom"}})
|
|
|
|
var ce *ClaudeError
|
|
if !errors.As(err, &ce) {
|
|
t.Fatal("errors.As(*ClaudeError) should match a *ClaudeTimeoutError")
|
|
}
|
|
if ce.Msg != "timeout" {
|
|
t.Errorf("unwrapped Msg = %q, want %q", ce.Msg, "timeout")
|
|
}
|
|
|
|
var te *ClaudeTimeoutError
|
|
if !errors.As(err, &te) {
|
|
t.Fatal("errors.As(*ClaudeTimeoutError) should still match")
|
|
}
|
|
}
|