TestWrapDocInputFileErr pins that a --file stat/read failure becomes a typed validation error tagged with the --file param and the cause preserved, so an agent knows which flag to fix even though the shared helper is flag-agnostic.
(t *testing.T)
| 318 | // validation error tagged with the --file param and the cause preserved, so an |
| 319 | // agent knows which flag to fix even though the shared helper is flag-agnostic. |
| 320 | func TestWrapDocInputFileErr(t *testing.T) { |
| 321 | raw := errors.New("no such file or directory") |
| 322 | got := wrapDocInputFileErr(raw, "file not found") |
| 323 | var ve *errs.ValidationError |
| 324 | if !errors.As(got, &ve) { |
| 325 | t.Fatalf("error type = %T, want *errs.ValidationError (%v)", got, got) |
| 326 | } |
| 327 | if ve.Subtype != errs.SubtypeInvalidArgument { |
| 328 | t.Errorf("subtype = %q, want %q", ve.Subtype, errs.SubtypeInvalidArgument) |
| 329 | } |
| 330 | if ve.Param != "--file" { |
| 331 | t.Errorf("param = %q, want %q", ve.Param, "--file") |
| 332 | } |
| 333 | if !errors.Is(got, raw) { |
| 334 | t.Error("cause not chained: errors.Is(got, raw) == false") |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | func TestValidateUpdateV2Contract(t *testing.T) { |
| 339 | cases := []struct { |
nothing calls this directly
no test coverage detected