From 118ea78d95a82d9f943180c8f976befc5d2dc97e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 11 Mar 2023 23:12:25 +0100 Subject: Matrix: allow pressing enter on a message with a room alias to join the room --- tests/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/main.cpp b/tests/main.cpp index 0eae9ba..bfece6e 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -121,5 +121,25 @@ int main() { assert_equals(extract_user_name_from_email("@dec05eba:domain.com"), ""); assert_equals(extract_user_name_from_email("dec05eba"), ""); + auto room_ids = matrix_extract_room_ids("hello #sneed:matrix.org world #feed:midov.pl"); + assert_equals(room_ids.size(), 2); + assert_equals(room_ids[0], "#sneed:matrix.org"); + assert_equals(room_ids[1], "#feed:midov.pl"); + + room_ids = matrix_extract_room_ids("#sneed:matrix.org"); + assert_equals(room_ids.size(), 1); + assert_equals(room_ids[0], "#sneed:matrix.org"); + + room_ids = matrix_extract_room_ids("#sneedmatrix.org"); + assert_equals(room_ids.size(), 0); + + room_ids = matrix_extract_room_ids("!sneed:matrix.org"); + assert_equals(room_ids.size(), 0); + //assert_equals(room_ids.size(), 1); + //assert_equals(room_ids[0], "!sneed:matrix.org"); + + room_ids = matrix_extract_room_ids("@sneed:matrix.org"); + assert_equals(room_ids.size(), 0); + return 0; } -- cgit v1.2.3