carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1// approved_region_ha_copy_test.go
2package main
3
4import (
5 "os"
6 "regexp"
7 "strconv"
8 "testing"
9)
10
11// The copy gate of region HA plan 2a (Task 1). The record is a markdown
12// table in the moves record's format, read with the moves gate's parser
13// and checked with the run gate's helpers, so "approved" and "applied"
14// mean what they mean there:
15//
16// - TestRegionHACopyRecordIsComplete: the record names exactly RHA-C1 to
17// RHA-C25;
18// - TestRegionHACopyHasNoEmDash;
19// - TestRegionHABuiltCopyIsApproved: an id in regionHACopyBuilt is an
20// approved row. No pending string reaches code, CLI help or docs;
21// - TestRegionHABuiltCopyIsApplied: a built row's text is in the file it
22// names.
23const regionHACopyRecordPath = "docs/superpowers/plans/2026-10-16-region-ha-2a-copy.md"
24
25var regionHACopyIDPattern = regexp.MustCompile(`^RHA-C[0-9]+$`)
26
27// regionHACopyIDs is the record's inventory: RHA-C1 to RHA-C25, pinned
28// (RHA-C17 to RHA-C19 are Task 11's; RHA-C20 to RHA-C25 are Task 10's
29// further rows).
30var regionHACopyIDs = func() []string {
31 ids := make([]string, 0, 25)
32 for i := 1; i <= 25; i++ {
33 ids = append(ids, "RHA-C"+strconv.Itoa(i))
34 }
35 return ids
36}()
37
38// regionHACopyBuilt is every id whose text the code or docs carry. The
39// task that writes a row's text adds its id here in the same commit, once
40// Paul has approved the row.
41var regionHACopyBuilt = []string{"RHA-C1", "RHA-C2", "RHA-C3", "RHA-C4", "RHA-C5", "RHA-C6", "RHA-C7", "RHA-C8", "RHA-C9", "RHA-C10", "RHA-C11", "RHA-C12", "RHA-C13", "RHA-C14", "RHA-C15", "RHA-C16", "RHA-C17", "RHA-C18", "RHA-C19", "RHA-C20", "RHA-C21", "RHA-C22", "RHA-C23", "RHA-C24", "RHA-C25"}
42
43func mustParseRegionHARecord(t *testing.T) []copyRow {
44 t.Helper()
45 raw, err := os.ReadFile(regionHACopyRecordPath)
46 if err != nil {
47 t.Fatal(err)
48 }
49 rows, err := parseCopyTable(string(raw), regionHACopyRecordPath, regionHACopyIDPattern, "an RHA-C<n>")
50 if err != nil {
51 t.Fatal(err)
52 }
53 return rows
54}
55
56func TestRegionHACopyRecordIsComplete(t *testing.T) {
57 reportAll(t, checkMovesInventory(mustParseRegionHARecord(t), regionHACopyIDs))
58}
59
60func TestRegionHACopyHasNoEmDash(t *testing.T) {
61 reportAll(t, checkMovesNoEmDash(mustParseRegionHARecord(t)))
62}
63
64func TestRegionHABuiltCopyIsApproved(t *testing.T) {
65 reportAll(t, checkRunBuilt(mustParseRegionHARecord(t), regionHACopyBuilt))
66}
67
68func TestRegionHABuiltCopyIsApplied(t *testing.T) {
69 reportAll(t, checkRunApplied(builtRows(mustParseRegionHARecord(t), regionHACopyBuilt), "."))
70}
71