add focused unit and map checks
This commit is contained in:
32
tests/test_util.c
Normal file
32
tests/test_util.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "test.h"
|
||||
|
||||
Str
|
||||
mkstr(char *s)
|
||||
{
|
||||
Str r;
|
||||
|
||||
sinit(&r, s, strlen(s));
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
checkstr(struct ct *t, char *where, char *want, Str *got)
|
||||
{
|
||||
char buf[Maxutf];
|
||||
|
||||
stoutf(got, buf, sizeof buf);
|
||||
if(strcmp(want, buf) == 0)
|
||||
return 1;
|
||||
return CT_ERRORF(t, "%s: want \"%s\", got \"%s\"",
|
||||
where, want, buf);
|
||||
}
|
||||
|
||||
Str
|
||||
shownpre(Im *state)
|
||||
{
|
||||
Str shown;
|
||||
|
||||
if(state->l->map != nil && mapget(state->l->map, &state->pre, &shown))
|
||||
return shown;
|
||||
return state->pre;
|
||||
}
|
||||
Reference in New Issue
Block a user