about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-01-27 22:13:09 +0000
committerJames Booth <boothj5@gmail.com>2015-01-27 22:13:09 +0000
commit2cdbfc7eb7d90ed286c6c5f432990166cdec0b93 (patch)
tree678c2bcd6edae1c335e428103bb2af9b7471b8a2 /tests
parent25d31101bfb365c8224ef09f84a92794a89e975f (diff)
downloadprofani-tty-2cdbfc7eb7d90ed286c6c5f432990166cdec0b93.tar.gz
Added gnu readline
Diffstat (limited to 'tests')
-rw-r--r--tests/helpers.c18
-rw-r--r--tests/helpers.h2
-rw-r--r--tests/test_keyhandlers.c365
-rw-r--r--tests/test_keyhandlers.h35
-rw-r--r--tests/testsuite.c36
-rw-r--r--tests/ui/stub_ui.c3
6 files changed, 276 insertions, 183 deletions
diff --git a/tests/helpers.c b/tests/helpers.c
index 10310886..564b2716 100644
--- a/tests/helpers.c
+++ b/tests/helpers.c
@@ -85,6 +85,24 @@ void close_chat_sessions(void **state)
     close_preferences(NULL);
 }
 
+int
+utf8_pos_to_col(char *str, int utf8_pos)
+{
+    int col = 0;
+
+    int i = 0;
+    for (i = 0; i<utf8_pos; i++) {
+        col++;
+        gchar *ch = g_utf8_offset_to_pointer(str, i);
+        gunichar uni = g_utf8_get_char(ch);
+        if (g_unichar_iswide(uni)) {
+            col++;
+        }
+    }
+
+    return col;
+}
+
 static GCompareFunc cmp_func;
 
 void
diff --git a/tests/helpers.h b/tests/helpers.h
index 2d7af6e7..75d446d0 100644
--- a/tests/helpers.h
+++ b/tests/helpers.h
@@ -6,5 +6,7 @@ void close_preferences(void **state);
 void init_chat_sessions(void **state);
 void close_chat_sessions(void **state);
 
+int utf8_pos_to_col(char *str, int utf8_pos);
+
 void glist_set_cmp(GCompareFunc func);
 int glist_contents_equal(const void *actual, const void *expected);
\ No newline at end of file
diff --git a/tests/test_keyhandlers.c b/tests/test_keyhandlers.c
index 32582c2e..a6d39143 100644
--- a/tests/test_keyhandlers.c
+++ b/tests/test_keyhandlers.c
@@ -1,5 +1,3 @@
-#include "ui/keyhandlers.h"
-#include "ui/inputwin.h"
 #include <stdarg.h>
 #include <stddef.h>
 #include <setjmp.h>
@@ -9,26 +7,15 @@
 
 #include <locale.h>
 
-static char line[INP_WIN_MAX];
-
-static int utf8_pos_to_col(char *str, int utf8_pos)
-{
-    int col = 0;
+#include "ui/keyhandlers.h"
+#include "ui/inputwin.h"
+#include "tests/helpers.h"
 
-    int i = 0;
-    for (i = 0; i<utf8_pos; i++) {
-        col++;
-        gchar *ch = g_utf8_offset_to_pointer(str, i);
-        gunichar uni = g_utf8_get_char(ch);
-        if (g_unichar_iswide(uni)) {
-            col++;
-        }
-    }
+static char line[INP_WIN_MAX];
 
-    return col;
-}
+// append
 
-void append_non_wide_to_empty(void **state)
+void append_to_empty(void **state)
 {
     setlocale(LC_ALL, "");
     line[0] = '\0';
@@ -60,7 +47,7 @@ void append_wide_to_empty(void **state)
     assert_int_equal(pad_start, 0);
 }
 
-void append_non_wide_to_non_wide(void **state)
+void append_to_single(void **state)
 {
     setlocale(LC_ALL, "");
     g_utf8_strncpy(line, "a", 1);
@@ -77,7 +64,8 @@ void append_non_wide_to_non_wide(void **state)
     assert_int_equal(pad_start, 0);
 }
 
-void append_wide_to_non_wide(void **state)
+
+void append_wide_to_single_non_wide(void **state)
 {
     setlocale(LC_ALL, "");
     g_utf8_strncpy(line, "a", 1);
@@ -94,7 +82,7 @@ void append_wide_to_non_wide(void **state)
     assert_int_equal(pad_start, 0);
 }
 
-void append_non_wide_to_wide(void **state)
+void append_non_wide_to_single_wide(void **state)
 {
     setlocale(LC_ALL, "");
     g_utf8_strncpy(line, "四", 1);
@@ -111,7 +99,7 @@ void append_non_wide_to_wide(void **state)
     assert_int_equal(pad_start, 0);
 }
 
-void append_wide_to_wide(void **state)
+void append_wide_to_single_wide(void **state)
 {
     setlocale(LC_ALL, "");
     g_utf8_strncpy(line, "四", 1);
@@ -147,25 +135,6 @@ void append_non_wide_when_overrun(void **state)
     assert_int_equal(pad_start, 3);
 }
 
-void append_wide_when_overrun(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "0123456789四1234567", 18);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 18;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 0;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 20);
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 20);
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 20);
-
-    assert_string_equal("0123456789四1234567三三三", line);
-    assert_int_equal(line_utf8_pos, 21);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 6);
-}
-
 void insert_non_wide_to_non_wide(void **state)
 {
     setlocale(LC_ALL, "");
@@ -183,57 +152,6 @@ void insert_non_wide_to_non_wide(void **state)
     assert_int_equal(pad_start, 0);
 }
 
-void insert_wide_to_non_wide(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "abcd", 26);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 2;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 0;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x304C, 80);
-
-    assert_string_equal("abがcd", line);
-    assert_int_equal(line_utf8_pos, 3);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 0);
-}
-
-void insert_non_wide_to_wide(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "ひらなひ", 4);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 2;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 0;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, '0', 80);
-
-    assert_string_equal("ひら0なひ", line);
-    assert_int_equal(line_utf8_pos, 3);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 0);
-}
-
-void insert_wide_to_wide(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "ひらなひ", 4);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 2;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 0;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 80);
-
-    assert_string_equal("ひら三なひ", line);
-    assert_int_equal(line_utf8_pos, 3);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 0);
-}
-
 void insert_single_non_wide_when_pad_scrolled(void **state)
 {
     setlocale(LC_ALL, "");
@@ -270,42 +188,6 @@ void insert_many_non_wide_when_pad_scrolled(void **state)
     assert_int_equal(pad_start, 2);
 }
 
-void insert_single_wide_when_pad_scrolled(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "AAAAAAAAAAAAAAA", 15);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 2;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 2;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 12);
-
-    assert_string_equal("AA三AAAAAAAAAAAAA", line);
-    assert_int_equal(line_utf8_pos, 3);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 2);
-}
-
-void insert_many_wide_when_pad_scrolled(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "AAAAAAAAAAAAAAA", 15);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 2;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 2;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x304C, 12);
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x304C, 12);
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 12);
-
-    assert_string_equal("AAがが三AAAAAAAAAAAAA", line);
-    assert_int_equal(line_utf8_pos, 5);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 2);
-}
-
 void insert_single_non_wide_last_column(void **state)
 {
     setlocale(LC_ALL, "");
@@ -341,39 +223,19 @@ void insert_many_non_wide_last_column(void **state)
     assert_int_equal(pad_start, 4);
 }
 
-void insert_single_wide_last_column(void **state)
+void ctrl_left_when_no_input(void **state)
 {
     setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "abcdefghijklmno", 15);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 7;
-    int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 2;
-
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 5);
-
-    assert_string_equal("abcdefg三hijklmno", line);
-    assert_int_equal(line_utf8_pos, 8);
-    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 4);
-}
-
-void insert_many_wide_last_column(void **state)
-{
-    setlocale(LC_ALL, "");
-    g_utf8_strncpy(line, "abcdefghijklmno", 15);
-    line[strlen(line)] = '\0';
-    int line_utf8_pos = 7;
+    line[0] = '\0';
+    int line_utf8_pos = 0;
     int col = utf8_pos_to_col(line, line_utf8_pos);
-    int pad_start = 2;
+    int pad_start = 0;
 
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x4E09, 5);
-    key_printable(line, &line_utf8_pos, &col, &pad_start, 0x304C, 5);
+    key_ctrl_left(line, &line_utf8_pos, &col, &pad_start, 80);
 
-    assert_string_equal("abcdefg三がhijklmno", line);
-    assert_int_equal(line_utf8_pos, 9);
+    assert_int_equal(line_utf8_pos, 0);
     assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
-    assert_int_equal(pad_start, 6);
+    assert_int_equal(pad_start, 0);
 }
 
 void ctrl_left_when_at_start(void **state)
@@ -678,4 +540,195 @@ void ctrl_left_when_word_overrun_to_left(void **state)
     assert_int_equal(line_utf8_pos, 9);
     assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
     assert_int_equal(pad_start, 9);
+}
+
+void ctrl_right_when_no_input(void **state)
+{
+    setlocale(LC_ALL, "");
+    line[0] = '\0';
+    int line_utf8_pos = 0;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 0);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_when_at_end(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword anotherword", 20);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 20;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 20);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_one_word_at_start(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword", 8);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 0;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 8);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_one_word_in_middle(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword", 8);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 3;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 8);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_one_word_at_end(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword", 8);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 7;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 8);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_two_words_from_middle_first(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword anotherword", 20);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 4;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 8);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_two_words_from_end_first(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword anotherword", 20);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 7;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 8);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_two_words_from_space(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword anotherword", 20);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 8;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 20);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_two_words_from_start_second(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword anotherword", 20);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 9;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 20);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_one_word_leading_whitespace(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "       someword", 15);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 3;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 15);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_two_words_in_whitespace(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "       someword        adfasdf", 30);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 19;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 30);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
+}
+
+void ctrl_right_trailing_whitespace_from_middle(void **state)
+{
+    setlocale(LC_ALL, "");
+    g_utf8_strncpy(line, "someword        ", 16);
+    line[strlen(line)] = '\0';
+    int line_utf8_pos = 3;
+    int col = utf8_pos_to_col(line, line_utf8_pos);
+    int pad_start = 0;
+
+    key_ctrl_right(line, &line_utf8_pos, &col, &pad_start, 80);
+
+    assert_int_equal(line_utf8_pos, 8);
+    assert_int_equal(col, utf8_pos_to_col(line, line_utf8_pos));
+    assert_int_equal(pad_start, 0);
 }
\ No newline at end of file
diff --git a/tests/test_keyhandlers.h b/tests/test_keyhandlers.h
index 4db5f340..4be429a9 100644
--- a/tests/test_keyhandlers.h
+++ b/tests/test_keyhandlers.h
@@ -1,24 +1,18 @@
-void append_non_wide_to_empty(void **state);
+void append_to_empty(void **state);
 void append_wide_to_empty(void **state);
-void append_non_wide_to_non_wide(void **state);
-void append_wide_to_non_wide(void **state);
-void append_non_wide_to_wide(void **state);
-void append_wide_to_wide(void **state);
+void append_to_single(void **state);
+void append_wide_to_single_non_wide(void **state);
+void append_non_wide_to_single_wide(void **state);
+void append_wide_to_single_wide(void **state);
 void append_non_wide_when_overrun(void **state);
-void append_wide_when_overrun(void **state);
+
 void insert_non_wide_to_non_wide(void **state);
-void insert_wide_to_non_wide(void **state);
-void insert_non_wide_to_wide(void **state);
-void insert_wide_to_wide(void **state);
 void insert_single_non_wide_when_pad_scrolled(void **state);
 void insert_many_non_wide_when_pad_scrolled(void **state);
-void insert_single_wide_when_pad_scrolled(void **state);
-void insert_many_wide_when_pad_scrolled(void **state);
 void insert_single_non_wide_last_column(void **state);
 void insert_many_non_wide_last_column(void **state);
-void insert_single_wide_last_column(void **state);
-void insert_many_wide_last_column(void **state);
 
+void ctrl_left_when_no_input(void **state);
 void ctrl_left_when_at_start(void **state);
 void ctrl_left_when_in_first_word(void **state);
 void ctrl_left_when_in_first_space(void **state);
@@ -37,4 +31,17 @@ void ctrl_left_when_start_whitespace_middle_of_word(void **state);
 void ctrl_left_in_whitespace_between_words(void **state);
 void ctrl_left_in_whitespace_between_words_start_of_word(void **state);
 void ctrl_left_in_whitespace_between_words_middle_of_word(void **state);
-void ctrl_left_when_word_overrun_to_left(void **state);
\ No newline at end of file
+void ctrl_left_when_word_overrun_to_left(void **state);
+
+void ctrl_right_when_no_input(void **state);
+void ctrl_right_when_at_end(void **state);
+void ctrl_right_one_word_at_start(void **state);
+void ctrl_right_one_word_in_middle(void **state);
+void ctrl_right_one_word_at_end(void **state);
+void ctrl_right_two_words_from_middle_first(void **state);
+void ctrl_right_two_words_from_end_first(void **state);
+void ctrl_right_two_words_from_space(void **state);
+void ctrl_right_two_words_from_start_second(void **state);
+void ctrl_right_one_word_leading_whitespace(void **state);
+void ctrl_right_two_words_in_whitespace(void **state);
+void ctrl_right_trailing_whitespace_from_middle(void **state);
\ No newline at end of file
diff --git a/tests/testsuite.c b/tests/testsuite.c
index 1a5e0f7e..ca53961f 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -624,26 +624,23 @@ int main(int argc, char* argv[]) {
 
         unit_test(clears_chat_sessions),
 
-        unit_test(append_non_wide_to_empty),
+        unit_test(append_to_empty),
         unit_test(append_wide_to_empty),
-        unit_test(append_non_wide_to_non_wide),
-        unit_test(append_wide_to_non_wide),
-        unit_test(append_non_wide_to_wide),
-        unit_test(append_wide_to_wide),
+
+        unit_test(append_to_single),
+        unit_test(append_wide_to_single_non_wide),
+        unit_test(append_non_wide_to_single_wide),
+        unit_test(append_wide_to_single_wide),
+
         unit_test(append_non_wide_when_overrun),
-        unit_test(append_wide_when_overrun),
+
         unit_test(insert_non_wide_to_non_wide),
-        unit_test(insert_wide_to_non_wide),
-        unit_test(insert_non_wide_to_wide),
-        unit_test(insert_wide_to_wide),
         unit_test(insert_single_non_wide_when_pad_scrolled),
         unit_test(insert_many_non_wide_when_pad_scrolled),
-        unit_test(insert_single_wide_when_pad_scrolled),
-        unit_test(insert_many_wide_when_pad_scrolled),
         unit_test(insert_single_non_wide_last_column),
         unit_test(insert_many_non_wide_last_column),
-        unit_test(insert_single_wide_last_column),
-        unit_test(insert_many_wide_last_column),
+
+        unit_test(ctrl_left_when_no_input),
         unit_test(ctrl_left_when_at_start),
         unit_test(ctrl_left_when_in_first_word),
         unit_test(ctrl_left_when_in_first_space),
@@ -663,6 +660,19 @@ int main(int argc, char* argv[]) {
         unit_test(ctrl_left_in_whitespace_between_words_start_of_word),
         unit_test(ctrl_left_in_whitespace_between_words_middle_of_word),
         unit_test(ctrl_left_when_word_overrun_to_left),
+
+        unit_test(ctrl_right_when_no_input),
+        unit_test(ctrl_right_when_at_end),
+        unit_test(ctrl_right_one_word_at_start),
+        unit_test(ctrl_right_one_word_in_middle),
+        unit_test(ctrl_right_one_word_at_end),
+        unit_test(ctrl_right_two_words_from_middle_first),
+        unit_test(ctrl_right_two_words_from_end_first),
+        unit_test(ctrl_right_two_words_from_space),
+        unit_test(ctrl_right_two_words_from_start_second),
+        unit_test(ctrl_right_one_word_leading_whitespace),
+        unit_test(ctrl_right_two_words_in_whitespace),
+        unit_test(ctrl_right_trailing_whitespace_from_middle),
     };
 
     return run_tests(all_tests);
diff --git a/tests/ui/stub_ui.c b/tests/ui/stub_ui.c
index 51b82d42..6b9050c3 100644
--- a/tests/ui/stub_ui.c
+++ b/tests/ui/stub_ui.c
@@ -348,6 +348,9 @@ gboolean ui_win_has_unsaved_form(int num)
     return FALSE;
 }
 
+void
+ui_write(char *line, int offset) {}
+
 // console window actions
 
 void cons_show(const char * const msg, ...)