| 1 | package notionmd |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "amadan.net/oficina/mapa/internal/mapa/markup" |
| 7 | ) |
| 8 | |
| 9 | // Fable L5: the structure check refuses a written block that would carry |
| 10 | // a ^id the mapper never meant. Neutralising normally stops one forming, |
| 11 | // so the check is tested on its own, with an un-neutralised block. |
| 12 | // |
| 13 | // A block whose whole text is a marker ("## ^only", "- ^only") is |
| 14 | // refused by the marker clause alone, so the clause has its own |
| 15 | // mutation (Fable round 2, Low 3: the earlier note that it could never |
| 16 | // be the only refusal was wrong). |
| 17 | // |
| 18 | // Mutation (make mutate, first red 2026-11-17): the check ignores a |
| 19 | // marker. |
| 20 | func TestTheCheckRefusesAMarker(t *testing.T) { |
| 21 | marked := written{kind: markup.Paragraph, |
| 22 | lines: []line{{lit("ends with a marker ^word")}}} |
| 23 | if check(marked) { |
| 24 | t.Error("the check passed a block that reads as carrying ^word") |
| 25 | } |
| 26 | for _, only := range []written{ |
| 27 | {kind: markup.Heading, level: 2, lines: []line{{lit("^only")}}}, |
| 28 | {kind: markup.Item, lines: []line{{lit("^only")}}}, |
| 29 | {kind: markup.Item, ordered: true, number: 1, |
| 30 | lines: []line{{lit("^only")}}}, |
| 31 | {kind: markup.Quote, lines: []line{{lit("^only")}}}, |
| 32 | } { |
| 33 | if check(only) { |
| 34 | t.Errorf("the check passed %q, all marker", only.source()) |
| 35 | } |
| 36 | } |
| 37 | plain := written{kind: markup.Paragraph, |
| 38 | lines: []line{{lit("ends with no marker")}}} |
| 39 | if !check(plain) { |
| 40 | t.Error("the check refused a plain paragraph") |
| 41 | } |
| 42 | } |
| 43 | |