466-b review: the insight-links case fails with either check disabled
Builds: design 55 §4, §5; lead answer L-466-3 (issue 466 note 18); 466/AC4
This commit is contained in:
@@ -97,16 +97,45 @@ func TestEveryPerRecordRuleRefusesAProposal(t *testing.T) {
|
||||
p.Date, p.NeedsOperator = "2026-10-13", true
|
||||
}},
|
||||
{"insight-links", func(p *ProposeAsk, w *world, t *testing.T) {
|
||||
// 466/AC4: an insight that drops the changes link of the accepted record is refused, and one that adds a
|
||||
// 466/AC4: an accepted record holding a supersedes and a changes link; an insight that drops the
|
||||
// supersedes or adds a changes is refused, each link named and a new record asked for; one that adds a
|
||||
// cites link is taken.
|
||||
w.accepted(t, "author@test", valid(p.Number))
|
||||
p.Insight = "it said the clause stood"
|
||||
cites := *p
|
||||
cites.Links = append(append([]LinkAsk(nil), p.Links...), LinkAsk{Kind: LinkCites, To: "0011"})
|
||||
base := *p
|
||||
base.Links = append(append([]LinkAsk(nil), p.Links...), LinkAsk{Kind: LinkSupersedes, To: "0162"})
|
||||
w.accepted(t, "author@test", base)
|
||||
insight := func(links ...LinkAsk) ProposeAsk {
|
||||
q := base
|
||||
q.Insight = "it said the clause stood"
|
||||
q.Links = links
|
||||
return q
|
||||
}
|
||||
kept := base.Links
|
||||
cites := insight(append(append([]LinkAsk(nil), kept...), LinkAsk{Kind: LinkCites, To: "0011"})...)
|
||||
if _, err := w.k.Propose("author@test", cites); err != nil {
|
||||
t.Fatalf("an insight adding a cites link was refused: %v", err)
|
||||
}
|
||||
p.Links = p.Links[:1]
|
||||
dropped := insight(kept[:2]...)
|
||||
added := insight(append(append([]LinkAsk(nil), kept...), LinkAsk{Kind: LinkChanges, To: "0240 §1", From: 2})...)
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
ask ProposeAsk
|
||||
says []string
|
||||
not string
|
||||
}{
|
||||
{"dropping the supersedes", dropped, []string{"dropped supersedes ADR 0162", "write one"}, "added"},
|
||||
{"adding a changes", added, []string{"added §2 changes ADR 0240 §1", "write one"}, "dropped"},
|
||||
} {
|
||||
_, err := w.k.Propose("author@test", c.ask)
|
||||
if err == nil || !strings.Contains(err.Error(), "- insight-links:") || strings.Contains(err.Error(), c.not) {
|
||||
t.Fatalf("%s: %v", c.name, err)
|
||||
}
|
||||
for _, says := range c.says {
|
||||
if !strings.Contains(err.Error(), says) {
|
||||
t.Fatalf("%s: the refusal does not say %q: %v", c.name, says, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
*p = dropped
|
||||
}},
|
||||
{"section-form", func(p *ProposeAsk, w *world, t *testing.T) {
|
||||
p.Date, p.Sections[0].Name = "2026-11-04", "00-context.md"
|
||||
|
||||
Reference in New Issue
Block a user