aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2011-08-28 17:57:57 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2011-08-28 17:57:57 +0100
commit8793934328f40f79a634a05d8ba815f9b7bcd749 (patch)
treedf25896beb6bca6b2f27b800c53e163104f57c47 /t
parent26384996486963bc2f097f44a82a5c07e0dfe69e (diff)
downloadtermo-8793934328f40f79a634a05d8ba815f9b7bcd749.tar.gz
termo-8793934328f40f79a634a05d8ba815f9b7bcd749.tar.xz
termo-8793934328f40f79a634a05d8ba815f9b7bcd749.zip
Allow a flag to convert ASCII DEL into Backspace
Diffstat (limited to 't')
-rw-r--r--t/20canon.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/20canon.c b/t/20canon.c
index eccf2c6..35f84e2 100644
--- a/t/20canon.c
+++ b/t/20canon.c
@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
#define CLEAR_KEY do { key.type = -1; key.code.codepoint = -1; key.modifiers = -1; key.utf8[0] = 0; } while(0)
- plan_tests(18);
+ plan_tests(26);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
@@ -45,6 +45,22 @@ int main(int argc, char *argv[])
is_int(key.modifiers, 0, "key.modifiers for Space/symbol");
is_str(endp, "", "consumed entire input for Space/symbol");
+ CLEAR_KEY;
+ endp = termkey_strpkey(tk, "DEL", &key, 0);
+ is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type for Del/unconverted");
+ is_int(key.code.sym, TERMKEY_SYM_DEL, "key.code.codepoint for Del/unconverted");
+ is_int(key.modifiers, 0, "key.modifiers for Del/unconverted");
+ is_str(endp, "", "consumed entire input for Del/unconverted");
+
+ termkey_set_canonflags(tk, termkey_get_canonflags(tk) | TERMKEY_CANON_DELBS);
+
+ CLEAR_KEY;
+ endp = termkey_strpkey(tk, "DEL", &key, 0);
+ is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type for Del/as-backspace");
+ is_int(key.code.sym, TERMKEY_SYM_BACKSPACE, "key.code.codepoint for Del/as-backspace");
+ is_int(key.modifiers, 0, "key.modifiers for Del/as-backspace");
+ is_str(endp, "", "consumed entire input for Del/as-backspace");
+
termkey_destroy(tk);
return exit_status();