aboutsummaryrefslogtreecommitdiff
path: root/vt.c
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2021-07-02 07:36:39 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2021-07-02 07:46:28 +0000
commitb18d3aef17b59c97fd0dcdb881bfd88c36341571 (patch)
treebd2edb0e5139397fe0d58eb6f5e9d34e4c5613c6 /vt.c
parentchangelog: s/from/in (diff)
vt: add some unit tests for action_collect()
Diffstat (limited to 'vt.c')
-rw-r--r--vt.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/vt.c b/vt.c
index b9a4f4b0..b34f8fbe 100644
--- a/vt.c
+++ b/vt.c
@@ -412,6 +412,29 @@ action_collect(struct terminal *term, uint8_t c)
LOG_WARN("only four private/intermediate characters supported");
}
+UNITTEST
+{
+ struct terminal term = {.vt = {.private = 0}};
+ uint32_t expected = ' ';
+ action_collect(&term, ' ');
+ xassert(term.vt.private == expected);
+
+ expected |= '/' << 8;
+ action_collect(&term, '/');
+ xassert(term.vt.private == expected);
+
+ expected |= '<' << 16;
+ action_collect(&term, '<');
+ xassert(term.vt.private == expected);
+
+ expected |= '?' << 24;
+ action_collect(&term, '?');
+ xassert(term.vt.private == expected);
+
+ action_collect(&term, '?');
+ xassert(term.vt.private == expected);
+}
+
static void
action_esc_dispatch(struct terminal *term, uint8_t final)
{