diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-04-01 13:26:54 +0100 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-04-01 13:26:54 +0100 |
commit | dbb13defb7ab00b1f4e801f3daab7dd1a3744ac0 (patch) | |
tree | 4d7bd461bcc48380b3c353ac7b7cec2ed22d313b /t | |
parent | 6adb2324f5568c3045e97c1712a1bc6e3f9220cc (diff) | |
download | termo-dbb13defb7ab00b1f4e801f3daab7dd1a3744ac0.tar.gz termo-dbb13defb7ab00b1f4e801f3daab7dd1a3744ac0.tar.xz termo-dbb13defb7ab00b1f4e801f3daab7dd1a3744ac0.zip |
Provide a termkey_lookup_keyname that can do partial buffer parsing
Diffstat (limited to 't')
-rw-r--r-- | t/10keyname.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/10keyname.c b/t/10keyname.c index 0e69122..54bc208 100644 --- a/t/10keyname.c +++ b/t/10keyname.c @@ -5,8 +5,9 @@ int main(int argc, char *argv[]) { TermKey *tk; TermKeySym sym; + char *end; - plan_tests(3); + plan_tests(10); tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS); @@ -16,6 +17,19 @@ int main(int argc, char *argv[]) sym = termkey_keyname2sym(tk, "SomeUnknownKey"); is_int(sym, TERMKEY_SYM_UNKNOWN, "keyname2sym SomeUnknownKey"); + end = termkey_lookup_keyname(tk, "Up", &sym); + ok(!!end, "termkey_get_keyname Up returns non-NULL"); + is_str(end, "", "termkey_get_keyname Up return points at endofstring"); + is_int(sym, TERMKEY_SYM_UP, "termkey_get_keyname Up yields Up symbol"); + + end = termkey_lookup_keyname(tk, "DownMore", &sym); + ok(!!end, "termkey_get_keyname DownMore returns non-NULL"); + is_str(end, "More", "termkey_get_keyname DownMore return points at More"); + is_int(sym, TERMKEY_SYM_DOWN, "termkey_get_keyname DownMore yields Down symbol"); + + end = termkey_lookup_keyname(tk, "SomeUnknownKey", &sym); + ok(!end, "termkey_get_keyname SomeUnknownKey returns NULL"); + is_str(termkey_get_keyname(tk, TERMKEY_SYM_SPACE), "Space", "get_keyname SPACE"); termkey_destroy(tk); |