package mac import ( "context" "testing" "amadan.net/oficina/equipo/internal/wire" ) // codedProbes: every P probe's detail is codes with parameters, never // words (whole-branch fix 1, #6). func codedProbes(t *testing.T, ps ...wire.Probe) { t.Helper() for _, p := range ps { if parts, ok := wire.ParseProbeDetail(p.Detail); !ok || len(parts) == 0 { t.Errorf("%s: detail %q is not coded", p.ID, p.Detail) } } } func TestProbeDetailsCoded(t *testing.T) { f := newProbeFixture(t, allLines("denied")) codedProbes(t, RunProbes(context.Background(), f.h).Probes...) // P2's srt failures are checked coded where they are made // (TestP2SaysWhichStepFailed). f = newProbeFixture(t, allLines("denied")) caps := Capabilities(context.Background(), f.h.Exec, f.h.Tools) caps.Simulators = nil p, _, _ := probeP2(context.Background(), f.h, caps) codedProbes(t, p) f.h.Tools.SRT = "" p, _, _ = probeP2(context.Background(), f.h, caps) codedProbes(t, p) f = newProbeFixture(t, nil) f.h.Exposed = func(p string) bool { return p == "/Users/paul" } codedProbes(t, probeP4(context.Background(), f.h)) f.h.Paths.HomesUnknown = true codedProbes(t, probeP4(context.Background(), f.h)) }