aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-03-11 23:12:25 +0100
committerdec05eba <dec05eba@protonmail.com>2023-03-11 23:12:25 +0100
commit118ea78d95a82d9f943180c8f976befc5d2dc97e (patch)
treec8daf5216042f35a0019edcfee44f343df864807 /tests
parentcf28b9984b9661fbc64684cf046fa3256040ed1d (diff)
Matrix: allow pressing enter on a message with a room alias to join the room
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp20
1 files changed, 20 insertions, 0 deletions
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;
}