From 38a6cf2f8d2b636cdc227e68c474a4fc27ff9bfd Mon Sep 17 00:00:00 2001 From: Titus Date: Mon, 30 Nov 2026 14:54:56 +0100 Subject: [PATCH] Test: the id tail's three dash cases from folder spec 3.2 Dashes are kept unless the cut of eight begins with one or holds two; then the tail is cut from the id with every dash removed. The five cases are the spec's own and the same as the npm SDK's. Co-Authored-By: Claude Opus 5.5 --- tests/test_id_tail.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_id_tail.py b/tests/test_id_tail.py index a74196b..8a8b6c9 100644 --- a/tests/test_id_tail.py +++ b/tests/test_id_tail.py @@ -1,6 +1,8 @@ """An element file's id tail is the last 8 code points of its id (folder spec 3.2): an id with a character above -U+FFFF in its tail, or at the cut, names its file as the npm SDK names it (``test/id-tail.test.mjs`` there holds the -same two cases), and ``write_folder`` writes that name to disk.""" +U+FFFF in its tail, or at the cut, names its file as the npm SDK names it, and dashes are kept unless the cut of +eight begins with one or holds two, when the tail is cut from the id with every dash removed. The five cases are the +folder spec's own and the same as the npm SDK's ``test/id-tail.test.mjs``; ``write_folder`` writes each name to +disk.""" from __future__ import annotations @@ -19,9 +21,12 @@ [ (f"a1234567{E}", f"bob--1234567{E}.json"), (f"a{E}1234567", f"bob--{E}1234567.json"), + ("ab-cd-ef-gh1", "bob--d-ef-gh1.json"), + ("abcd-efghijk", "bob--defghijk.json"), + ("abc--defghij", "bob--cdefghij.json"), ], ) -def test_a_character_above_the_bmp_counts_as_one(tmp_path: Path, element_id: str, name: str) -> None: +def test_the_tail_of_eight_code_points(tmp_path: Path, element_id: str, name: str) -> None: assert element_filename(element_id, "Bob") == name out = tmp_path / "world" write_folder(out, {"id": "w-1", "name": "W"}, {"character": [{"id": element_id, "name": "Bob"}]})