aboutsummaryrefslogtreecommitdiff
path: root/t/20canon.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-28 05:56:13 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-28 13:03:04 +0200
commit3465d5553fbe88a75320d1da3f7228619492b036 (patch)
treeb2086113248a918c8863dadb58a5736a2be75583 /t/20canon.c
parent36bc6cd0952b2eddc17e7da803d85decf96d32cc (diff)
downloadtermo-3465d5553fbe88a75320d1da3f7228619492b036.tar.gz
termo-3465d5553fbe88a75320d1da3f7228619492b036.tar.xz
termo-3465d5553fbe88a75320d1da3f7228619492b036.zip
Make the tests work again
Our UTF-8 parsing now behaves differently, though.
Diffstat (limited to 't/20canon.c')
-rw-r--r--t/20canon.c107
1 files changed, 57 insertions, 50 deletions
diff --git a/t/20canon.c b/t/20canon.c
index 0460153..a60c2ef 100644
--- a/t/20canon.c
+++ b/t/20canon.c
@@ -1,67 +1,74 @@
#include "../termkey.h"
#include "taplib.h"
-int main(int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
- TermKey *tk;
- TermKeyKey key;
- const char *endp;
+ termkey_t *tk;
+ termkey_key_t key;
+ const char *endp;
-#define CLEAR_KEY do { key.type = -1; key.code.codepoint = -1; key.modifiers = -1; key.utf8[0] = 0; } while(0)
+#define CLEAR_KEY do { key.type = -1; key.code.codepoint = -1; \
+ key.modifiers = -1; key.multibyte[0] = 0; } while (0)
- plan_tests(26);
+ plan_tests (26);
- tk = termkey_new_abstract("vt100", 0);
+ tk = termkey_new_abstract ("vt100", NULL, 0);
- CLEAR_KEY;
- endp = termkey_strpkey(tk, " ", &key, 0);
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type for SP/unicode");
- is_int(key.code.codepoint, ' ', "key.code.codepoint for SP/unicode");
- is_int(key.modifiers, 0, "key.modifiers for SP/unicode");
- is_str(key.utf8, " ", "key.utf8 for SP/unicode");
- is_str(endp, "", "consumed entire input for SP/unicode");
+ CLEAR_KEY;
+ endp = termkey_strpkey (tk, " ", &key, 0);
+ is_int (key.type, TERMKEY_TYPE_KEY, "key.type for SP/unicode");
+ is_int (key.code.codepoint, ' ', "key.code.codepoint for SP/unicode");
+ is_int (key.modifiers, 0, "key.modifiers for SP/unicode");
+ is_str (key.multibyte, " ", "key.multibyte for SP/unicode");
+ is_str (endp, "", "consumed entire input for SP/unicode");
- CLEAR_KEY;
- endp = termkey_strpkey(tk, "Space", &key, 0);
- is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type for Space/unicode");
- is_int(key.code.codepoint, ' ', "key.code.codepoint for Space/unicode");
- is_int(key.modifiers, 0, "key.modifiers for Space/unicode");
- is_str(key.utf8, " ", "key.utf8 for Space/unicode");
- is_str(endp, "", "consumed entire input for Space/unicode");
+ CLEAR_KEY;
+ endp = termkey_strpkey (tk, "Space", &key, 0);
+ is_int (key.type, TERMKEY_TYPE_KEY, "key.type for Space/unicode");
+ is_int (key.code.codepoint, ' ', "key.code.codepoint for Space/unicode");
+ is_int (key.modifiers, 0, "key.modifiers for Space/unicode");
+ is_str (key.multibyte, " ", "key.multibyte for Space/unicode");
+ is_str (endp, "", "consumed entire input for Space/unicode");
- termkey_set_canonflags(tk, termkey_get_canonflags(tk) | TERMKEY_CANON_SPACESYMBOL);
+ termkey_set_canonflags (tk,
+ termkey_get_canonflags (tk) | TERMKEY_CANON_SPACESYMBOL);
- CLEAR_KEY;
- endp = termkey_strpkey(tk, " ", &key, 0);
- is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type for SP/symbol");
- is_int(key.code.sym, TERMKEY_SYM_SPACE, "key.code.codepoint for SP/symbol");
- is_int(key.modifiers, 0, "key.modifiers for SP/symbol");
- is_str(endp, "", "consumed entire input for SP/symbol");
+ CLEAR_KEY;
+ endp = termkey_strpkey (tk, " ", &key, 0);
+ is_int (key.type, TERMKEY_TYPE_KEYSYM, "key.type for SP/symbol");
+ is_int (key.code.sym, TERMKEY_SYM_SPACE,
+ "key.code.codepoint for SP/symbol");
+ is_int (key.modifiers, 0, "key.modifiers for SP/symbol");
+ is_str (endp, "", "consumed entire input for SP/symbol");
- CLEAR_KEY;
- endp = termkey_strpkey(tk, "Space", &key, 0);
- is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type for Space/symbol");
- is_int(key.code.sym, TERMKEY_SYM_SPACE, "key.code.codepoint for Space/symbol");
- 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, "Space", &key, 0);
+ is_int (key.type, TERMKEY_TYPE_KEYSYM, "key.type for Space/symbol");
+ is_int (key.code.sym, TERMKEY_SYM_SPACE,
+ "key.code.codepoint for Space/symbol");
+ 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");
+ 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);
+ 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");
+ 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();
+ termkey_destroy (tk);
+ return exit_status ();
}