test: Telex goes in the language table like every other map

The unit suite built a Lang of its own for Telex and loaded telex.map
into it, so the tests that drive the real table had to swap the map in
and out around themselves.  testmapinit loads it where it belongs.
This commit is contained in:
2026-08-17 12:20:39 +09:00
parent 3a90826238
commit e54783dc92
4 changed files with 14 additions and 39 deletions

View File

@@ -7,7 +7,6 @@
Channel *drawc;
Channel *keyc;
Lang testvi;
void
die(char *fmt, ...)
@@ -45,20 +44,16 @@ erealloc(void *p, ulong n)
static void
testmapinit(void)
{
Lang *jp, *kata;
Lang *jp, *kata, *vi;
jp = getlang(LangJP);
kata = getlang(LangJPK);
if(jp == nil || kata == nil)
vi = getlang(LangVI);
if(jp == nil || kata == nil || vi == nil)
die("test language is not registered");
jp->map = trieopen("../map/hira.map");
kata->map = trieopen("../map/kata.map");
memset(&testvi, 0, sizeof testvi);
testvi.lang = LangVI;
testvi.mapname = "telex";
testvi.trans = transvi;
testvi.back = backvi;
testvi.map = trieopen("../map/telex.map");
vi->map = trieopen("../map/telex.map");
}
#ifndef STRESS
@@ -170,8 +165,6 @@ threadmain(int argc, char **argv)
trieclose(langs[i].map);
langs[i].map = nil;
}
trieclose(testvi.map);
testvi.map = nil;
chanfree(drawc);
chanfree(keyc);
threadexitsall(status == 0 ? nil : "tests failed");