From f9e8c7faab0e318fc2f1b4285631eb9312bbb93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 7 Mar 2024 07:45:01 +0100 Subject: api: allow search by buffer id in function buffer_search (issue #2081) --- tests/unit/gui/test-gui-buffer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/unit/gui') 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)")); -- cgit v1.2.3