aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 14:35:23 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 14:35:23 +0000
commit7b3dc4be71e9c611bc4a6b191264f99eb642d44c (patch)
tree19aea2fd55a00f6d0fbaf252e327bc2b6850eea5 /t
parentd241d6216abcf3607a72e53b18f2d0b5882bb164 (diff)
downloadtermo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.tar.gz
termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.tar.xz
termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.zip
Return a real key type for unrecognised CSI sequences; allow accessing them by termkey_interpret_csi()
Diffstat (limited to 't')
-rw-r--r--t/39csi.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/39csi.c b/t/39csi.c
new file mode 100644
index 0000000..f3bb598
--- /dev/null
+++ b/t/39csi.c
@@ -0,0 +1,32 @@
+#include "../termkey.h"
+#include "taplib.h"
+
+int main(int argc, char *argv[])
+{
+ TermKey *tk;
+ TermKeyKey key;
+ long args[16];
+ size_t nargs = 16;
+ unsigned long command;
+
+ plan_tests(7);
+
+ tk = termkey_new_abstract("vt100", 0);
+
+ termkey_push_bytes(tk, "\e[5;25v", 7);
+
+ is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for position report");
+
+ is_int(key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI");
+
+ is_int(termkey_interpret_csi(tk, &key, args, &nargs, &command), TERMKEY_RES_KEY, "interpret_csi yields RES_KEY");
+
+ is_int(nargs, 2, "nargs for unknown CSI");
+ is_int(args[0], 5, "args[0] for unknown CSI");
+ is_int(args[1], 25, "args[1] for unknown CSI");
+ is_int(command, 'v', "command for unknown CSI");
+
+ termkey_destroy(tk);
+
+ return exit_status();
+}