| 1 | package lsp |
| 2 | |
| 3 | import ( |
| 4 | "errors" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | // A server whose approval no longer holds is not started, and the caller gets |
| 9 | // the verifier's own error rather than a missing-binary hint. |
| 10 | func TestSpawnRefusesAServerThatFailsVerification(t *testing.T) { |
| 11 | refused := errors.New("changed since approved") |
| 12 | m := NewManager(t.TempDir(), map[string]ServerSpec{"x": {Command: "definitely-not-installed", Verify: func() error { return refused }}}) |
| 13 | if _, err := m.spawn("x", m.specs["x"]); !errors.Is(err, refused) { |
| 14 | t.Fatalf("spawn = %v, want the verifier's refusal", err) |
| 15 | } |
| 16 | } |
| 17 |