[agent/codex:gpt-5.3-codex-spark] Read docs/RFC.md fully. Find ONE feature described in the sp... #20
2 changed files with 13 additions and 1 deletions
|
|
@ -181,6 +181,12 @@ func TestErrnoMapping(t *testing.T) {
|
|||
} else if !errors.Is(err, syscall.Errno(2)) {
|
||||
t.Fatalf("expected error type %v, got %T %v", syscall.Errno(2), err, err)
|
||||
}
|
||||
|
||||
if err := Errno(-2); err == nil {
|
||||
t.Fatal("expected non-nil error for negative errno")
|
||||
} else if !errors.Is(err, syscall.Errno(2)) {
|
||||
t.Fatalf("expected positive errno mapping from -2, got %T %v", err, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithErrnoReturnsBothResultAndError(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -847,7 +847,13 @@ func Errno(resultCode C.int) error {
|
|||
if resultCode == 0 {
|
||||
return nil
|
||||
}
|
||||
return syscall.Errno(resultCode)
|
||||
|
||||
recordedCode := resultCode
|
||||
if recordedCode < 0 {
|
||||
recordedCode = -recordedCode
|
||||
}
|
||||
|
||||
return syscall.Errno(recordedCode)
|
||||
}
|
||||
|
||||
// WithErrno runs a function that returns C.int and maps the result to Go error.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue