summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-03-13 14:03:14 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-03-13 14:03:14 +0100
commit947ca33c14c934f5d87aaec1775bc69e44aafd20 (patch)
tree2d96a22fa8d1e011d9683486b82ef53daffeb5eb
parent44ec7e8cfa1ee5b5ccea9b9a81e2394af55a1e54 (diff)
downloadweechat-947ca33c14c934f5d87aaec1775bc69e44aafd20.zip
tests: add tests on function gui_buffer_valid
-rw-r--r--tests/unit/gui/test-gui-buffer.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/unit/gui/test-gui-buffer.cpp b/tests/unit/gui/test-gui-buffer.cpp
index 1b056ca7b..401bfa1f5 100644
--- a/tests/unit/gui/test-gui-buffer.cpp
+++ b/tests/unit/gui/test-gui-buffer.cpp
@@ -469,7 +469,22 @@ TEST(GuiBuffer, UserSetCallbacks)
TEST(GuiBuffer, Valid)
{
- /* TODO: write tests */
+ struct t_gui_buffer *buffer;
+
+ buffer = gui_buffer_new (NULL, TEST_BUFFER_NAME,
+ &test_buffer_input_cb, NULL, NULL,
+ &test_buffer_close_cb, NULL, NULL);
+
+ LONGS_EQUAL(0, gui_buffer_valid ((struct t_gui_buffer *)0x1));
+ LONGS_EQUAL(0, gui_buffer_valid (buffer + 1));
+
+ /* NULL pointer is considered valid: to print on core buffer */
+ LONGS_EQUAL(1, gui_buffer_valid (NULL));
+
+ LONGS_EQUAL(1, gui_buffer_valid (gui_buffers));
+ LONGS_EQUAL(1, gui_buffer_valid (buffer));
+
+ gui_buffer_close (buffer);
}
/*