From 897e192544403097c616ff6618f064d92e354f6a Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 5 Mar 2026 13:51:28 +0100 Subject: [PATCH] ests: fix functional test rooms_query --- tests/functionaltests/proftest.c | 8 +++++--- tests/functionaltests/test_rooms.c | 9 ++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c index 74498bc1..954e17e9 100644 --- a/tests/functionaltests/proftest.c +++ b/tests/functionaltests/proftest.c @@ -105,7 +105,11 @@ prof_expect(int fd, ...) return 0; } if (g_regex_match(regex, clean_output, 0, &match_info)) { + gint start_pos, end_pos; + g_match_info_fetch_pos(match_info, 0, &start_pos, &end_pos); + g_string_truncate(accumulated_output, 0); + g_match_info_free(match_info); g_regex_unref(regex); g_free(clean_output); @@ -406,11 +410,9 @@ prof_output_exact(const char* text) int prof_output_regex(const char* text) { - gchar* escaped = g_regex_escape_string(text, -1); - gchar* pattern = g_strdup_printf(".*%s", escaped); + gchar* pattern = g_strdup_printf(".*%s", text); int res = prof_expect(fd, prof_expect_regexp, pattern, 1, prof_expect_end); g_free(pattern); - g_free(escaped); return res; } diff --git a/tests/functionaltests/test_rooms.c b/tests/functionaltests/test_rooms.c index d1d02cf0..2097a56c 100644 --- a/tests/functionaltests/test_rooms.c +++ b/tests/functionaltests/test_rooms.c @@ -10,8 +10,8 @@ void rooms_query(void** state) { - stbbr_for_id("prof_confreq_*", - "" + stbbr_for_query("http://jabber.org/protocol/disco#items", + "" "" "" "" @@ -22,11 +22,10 @@ rooms_query(void** state) prof_input("/rooms service conference.localhost"); - assert_true(prof_output_exact("chatroom@conference.localhost (A chat room)")); - assert_true(prof_output_exact("hangout@conference.localhost (Another chat room)")); + assert_true(prof_output_regex("Room list request sent: conference.localhost[\\s\\S]*chatroom@conference.localhost[\\s\\S]*hangout@conference.localhost")); assert_true(stbbr_last_received( - "" + "" "" "")); }