summaryrefslogtreecommitdiff
path: root/tests/unit/gui
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-12-17 17:37:02 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-12-18 14:13:14 +0100
commit6aedddd351d8103c6e46283ca3aca7aa4a04f149 (patch)
tree53a6b93871b5a61cbbe9ffca9ce566e4cb97722b /tests/unit/gui
parent9b917ccace653e8d583ce3f5a7886439bc994d56 (diff)
downloadweechat-6aedddd351d8103c6e46283ca3aca7aa4a04f149.zip
tests: add tests on function gui_input_delete_next_word
Diffstat (limited to 'tests/unit/gui')
-rw-r--r--tests/unit/gui/test-gui-input.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/tests/unit/gui/test-gui-input.cpp b/tests/unit/gui/test-gui-input.cpp
index a73ef92a8..2476baf7d 100644
--- a/tests/unit/gui/test-gui-input.cpp
+++ b/tests/unit/gui/test-gui-input.cpp
@@ -574,7 +574,52 @@ TEST(GuiInput, DeletePreviousWordWhitespace)
TEST(GuiInput, DeleteNextWord)
{
- /* TODO: write tests */
+ gui_input_replace_input (gui_buffers, "");
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+
+ gui_input_replace_input (gui_buffers, "abc");
+ gui_input_set_pos (gui_buffers, 0);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+
+ gui_input_replace_input (gui_buffers, "abc");
+ gui_input_set_pos (gui_buffers, 1);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(1, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("a", gui_buffers->input_buffer);
+
+ gui_input_replace_input (gui_buffers, " abc");
+ gui_input_set_pos (gui_buffers, 0);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
+
+ gui_input_replace_input (gui_buffers, "abc def");
+ gui_input_set_pos (gui_buffers, 0);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL(" def", gui_buffers->input_buffer);
+
+ gui_input_replace_input (gui_buffers, "abc def/ghi/jkl");
+ gui_input_set_pos (gui_buffers, 0);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL(" def/ghi/jkl", gui_buffers->input_buffer);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("/ghi/jkl", gui_buffers->input_buffer);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("/jkl", gui_buffers->input_buffer);
+ gui_input_delete_next_word (gui_buffers);
+ LONGS_EQUAL(0, gui_buffers->input_buffer_pos);
+ STRCMP_EQUAL("", gui_buffers->input_buffer);
}
/*