summaryrefslogtreecommitdiff
path: root/tests/unit/gui/test-gui-buffer.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-07 07:45:01 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-03-12 20:37:44 +0100
commitf9e8c7faab0e318fc2f1b4285631eb9312bbb93f (patch)
tree70012bf70b39fc619ab1ccc728b321219c74acf0 /tests/unit/gui/test-gui-buffer.cpp
parent5af0415508b0ecaca0c07640be10250dff59623a (diff)
downloadweechat-f9e8c7faab0e318fc2f1b4285631eb9312bbb93f.zip
api: allow search by buffer id in function buffer_search (issue #2081)
Diffstat (limited to 'tests/unit/gui/test-gui-buffer.cpp')
-rw-r--r--tests/unit/gui/test-gui-buffer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit/gui/test-gui-buffer.cpp b/tests/unit/gui/test-gui-buffer.cpp
index 1c4e1131b..60e3f1adc 100644
--- a/tests/unit/gui/test-gui-buffer.cpp
+++ b/tests/unit/gui/test-gui-buffer.cpp
@@ -1375,6 +1375,7 @@ TEST(GuiBuffer, SearchByFullName)
TEST(GuiBuffer, Search)
{
struct t_gui_buffer *buffer;
+ char str_id[128];
buffer = gui_buffer_new (NULL, TEST_BUFFER_NAME,
NULL, NULL, NULL,
@@ -1388,12 +1389,20 @@ TEST(GuiBuffer, Search)
POINTERS_EQUAL(gui_buffers, gui_buffer_search ("==", NULL));
POINTERS_EQUAL(gui_buffers, gui_buffer_search ("==", ""));
POINTERS_EQUAL(NULL, gui_buffer_search ("==", "(?i)"));
+ POINTERS_EQUAL(gui_buffers, gui_buffer_search ("==id", NULL));
+ POINTERS_EQUAL(gui_buffers, gui_buffer_search ("==id", ""));
POINTERS_EQUAL(NULL, gui_buffer_search ("==", "xxx"));
POINTERS_EQUAL(NULL, gui_buffer_search ("==", "weechat"));
POINTERS_EQUAL(gui_buffers, gui_buffer_search ("==", "core.weechat"));
POINTERS_EQUAL(buffer, gui_buffer_search ("==", "core." TEST_BUFFER_NAME));
+ POINTERS_EQUAL(NULL, gui_buffer_search ("==id", "xxx"));
+ POINTERS_EQUAL(NULL, gui_buffer_search ("==id", "-1"));
+ POINTERS_EQUAL(NULL, gui_buffer_search ("==id", "0"));
+ snprintf (str_id, sizeof (str_id), "%lld", gui_buffers->id);
+ POINTERS_EQUAL(gui_buffers, gui_buffer_search ("==id", str_id));
+
POINTERS_EQUAL(gui_buffers, gui_buffer_search ("", ""));
POINTERS_EQUAL(gui_buffers, gui_buffer_search ("", "(?i)"));