From b381093e32e17df813fb29ba5d74926da1670d47 Mon Sep 17 00:00:00 2001 From: Kros Dai Date: Thu, 8 Oct 2026 15:31:04 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test(region):=20derive=20china=20zo?= =?UTF-8?q?nes=20from=20tzdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - :white_check_mark: dropping a backward-compatible zone name from the profile now fails the test Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QuATgjU4mnqpqSLAKMQ14g --- test/shell.d/region-pacman-test.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/shell.d/region-pacman-test.sh b/test/shell.d/region-pacman-test.sh index d02ea60d..c2289b21 100644 --- a/test/shell.d/region-pacman-test.sh +++ b/test/shell.d/region-pacman-test.sh @@ -122,8 +122,16 @@ for profile in sorted((Path(os.environ["ROOT"]) / "default/regions").iterdir()): if zoneinfo.is_dir(): assert (zoneinfo / zone).is_file(), f"{profile.name} lists unknown timezone {zone}" +# The installer offers tzdata's backward-compatible names too, so China +# covers every name that links to its two zones and nothing else. china = {zone for zone, region in owners.items() if region == "cn"} -assert {"Asia/Shanghai", "Asia/Urumqi"} <= china, china -assert not china & {"Asia/Hong_Kong", "Asia/Macau", "Asia/Taipei"}, china +expected = {"Asia/Shanghai", "Asia/Urumqi"} +tzdata = zoneinfo / "tzdata.zi" +if tzdata.is_file(): + for line in tzdata.read_text().splitlines(): + fields = line.split() + if len(fields) == 3 and fields[0] == "L" and fields[1] in {"Asia/Shanghai", "Asia/Urumqi"}: + expected.add(fields[2]) +assert china == expected, (china, expected) PY pass "region profiles map each timezone to at most one region"