test: drive Korean and Vietnamese through the engine's own transstr

ko_test and vi_test replayed keys with private copies of transstr's
loop, and test_util reimplemented the shown preedit; the engine exports
impre(Im*, Str*) and transstr() instead, so a change to composition
rules is one edit.
This commit is contained in:
2026-08-16 16:25:40 +09:00
parent 849bf1278b
commit 826da31486
7 changed files with 32 additions and 78 deletions

View File

@@ -3,24 +3,10 @@
static void
typevi(struct ct *t, char *keys, char *want)
{
Emit e;
Im state;
Str out, shown;
char *p;
Str out, raw;
memset(&state, 0, sizeof state);
state.l = &testvi;
sclear(&out);
for(p = keys; *p != '\0'; p++){
e = transvi(&state, (uchar)*p);
sappend(&out, &e.s);
state.pre = e.next;
state.raw = e.raw;
if(!e.eat)
sputr(&out, (uchar)*p);
}
shown = shownpre(&state);
sappend(&out, &shown);
raw = mkstr(keys);
transstr(&testvi, &raw, &out);
checkstr(t, keys, want, &out);
}
@@ -79,7 +65,7 @@ vietnamese_backspace(struct ct *t)
state.raw = mkstr(cases[i].raw);
backvi(&state);
checkstr(t, cases[i].raw, cases[i].rawafter, &state.raw);
shown = shownpre(&state);
impre(&state, &shown);
checkstr(t, cases[i].raw, cases[i].after, &shown);
}
}