package membank import ( "testing" "textmachine/backend/internal/store" "textmachine/backend/internal/text" ) // TestApostropheFold covers the Task-6 re-audit finding: a typographic apostrophe (U+2019, // smart-quote editors) folds to ASCII on BOTH sides, so a source key O'Brien matches either // spelling (no silently empty) and the post-check does not false-MISS a д'Артаньян. Reverting the // isApostropheVariant folds breaks these. func TestApostropheFold(t *testing.T) { if text.NormalizeSourceKey("O’Brien") != text.NormalizeSourceKey("O'Brien") { t.Error("source: typographic and ASCII apostrophe must normalize identically") } if text.NormalizeTargetForm("д’Артаньян") != text.NormalizeTargetForm("д'Артаньян") { t.Error("target: typographic and ASCII apostrophe must normalize identically") } // End-to-end: an ASCII-apostrophe key matches a chunk written with a typographic apostrophe. e := gl("o'brien", "О'Брайен", "", "approved") b := bankFrom([]store.GlossaryEntry{e}) if _, ok := injMap(b.Select("mr o’brien arrived.", 1, nil, 0))["o'brien"]; !ok { t.Error("typographic apostrophe in the chunk must match the ASCII-apostrophe key") } }