From cb00476f09d5ab7e342f562e6c516f23c98aac88 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Thu, 8 Mar 2012 21:24:39 +0000 Subject: Added a termkey_is_started() accessor; unit test it a bit --- t/01base.c | 11 ++++++++++- termkey.c | 5 +++++ termkey.h.in | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/t/01base.c b/t/01base.c index 54ad44d..463a0ed 100644 --- a/t/01base.c +++ b/t/01base.c @@ -6,13 +6,22 @@ int main(int argc, char *argv[]) { TermKey *tk; - plan_tests(3); + plan_tests(6); tk = termkey_new_abstract("vt100", 0); ok(!!tk, "termkey_new_abstract"); is_int(termkey_get_buffer_size(tk), 256, "termkey_get_buffer_size"); + ok(termkey_is_started(tk), "termkey_is_started true after construction"); + + termkey_stop(tk); + + ok(!termkey_is_started(tk), "termkey_is_started false after termkey_stop()"); + + termkey_start(tk); + + ok(termkey_is_started(tk), "termkey_is_started true after termkey_start()"); termkey_destroy(tk); diff --git a/termkey.c b/termkey.c index 9286149..5f5a9a9 100644 --- a/termkey.c +++ b/termkey.c @@ -446,6 +446,11 @@ int termkey_stop(TermKey *tk) return 1; } +int termkey_is_started(TermKey *tk) +{ + return tk->is_started; +} + int termkey_get_fd(TermKey *tk) { return tk->fd; diff --git a/termkey.h.in b/termkey.h.in index 5b7a2ce..a96a9a2 100644 --- a/termkey.h.in +++ b/termkey.h.in @@ -163,6 +163,7 @@ void termkey_destroy(TermKey *tk); int termkey_start(TermKey *tk); int termkey_stop(TermKey *tk); +int termkey_is_started(TermKey *tk); int termkey_get_fd(TermKey *tk); -- cgit v1.2.3-70-g09d2