Allow passing fd = -1 to constructor to make an instance not associated with an fd; must use push_bytes to provide it input

This commit is contained in:
Paul LeoNerd Evans
2012-01-18 14:03:39 +00:00
parent 82ad14175c
commit 6d6afe788c
15 changed files with 28 additions and 16 deletions

View File

@@ -8,7 +8,7 @@ int main(int argc, char *argv[])
plan_tests(2);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
ok(!!tk, "termkey_new");

View File

@@ -12,7 +12,7 @@ int main(int argc, char *argv[])
/* Sanitise this just in case */
putenv("TERM=vt100");
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
is_int(termkey_get_buffer_remaining(tk), 256, "buffer free initially 256");

View File

@@ -11,7 +11,7 @@ int main(int argc, char *argv[])
/* Sanitise this just in case */
putenv("TERM=vt100");
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS|TERMKEY_FLAG_UTF8);
tk = termkey_new(-1, TERMKEY_FLAG_UTF8);
termkey_push_bytes(tk, "a", 1);

View File

@@ -12,7 +12,7 @@ int main(int argc, char *argv[])
/* Sanitise this just in case */
putenv("TERM=vt100");
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
termkey_push_bytes(tk, " ", 1);

View File

@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
plan_tests(10);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
sym = termkey_keyname2sym(tk, "Space");
is_int(sym, TERMKEY_SYM_SPACE, "keyname2sym Space");

View File

@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
plan_tests(28);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
key.type = TERMKEY_TYPE_UNICODE;
key.code.codepoint = 'A';

View File

@@ -11,7 +11,7 @@ int main(int argc, char *argv[])
plan_tests(53);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
CLEAR_KEY;
endp = termkey_strpkey(tk, "A", &key, 0);

View File

@@ -8,7 +8,7 @@ int main(int argc, char *argv[])
plan_tests(12);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
key1.type = TERMKEY_TYPE_UNICODE;
key1.code.codepoint = 'A';

View File

@@ -11,7 +11,7 @@ int main(int argc, char *argv[])
plan_tests(26);
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
tk = termkey_new(-1, 0);
CLEAR_KEY;
endp = termkey_strpkey(tk, " ", &key, 0);