aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-02 20:02:45 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-02 20:02:45 +0100
commit3aacdd395f20fa182413be92a49cbd5c5a780ab9 (patch)
tree228a44c0b51040c39459f09d011a0a85b0c26ed9 /tests
parentc15aa4decf523b81d87925942642507fe7d02848 (diff)
Matrix: extract username if login is email or user id
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 41ef45d..0eae9ba 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -2,6 +2,7 @@
#include <string.h>
#include "../include/NetUtils.hpp"
#include "../plugins/utils/EpisodeNameParser.hpp"
+#include "../plugins/Matrix.hpp"
#include "../generated/Emoji.hpp"
#define assert_fail(str) do { fprintf(stderr, "Assert failed on line %d, reason: %s\n", __LINE__, (str)); exit(1); } while(0)
@@ -112,5 +113,13 @@ int main() {
assert_equals(emoji_sequence_length, 4);
assert_equals(emoji_sequence_byte_length, 13);
+ assert_equals(extract_user_name_from_user_id("@dec05eba:domail.com"), "dec05eba");
+ assert_equals(extract_user_name_from_user_id("dec05eba@domain.com"), "");
+ assert_equals(extract_user_name_from_user_id("dec05eba"), "");
+
+ assert_equals(extract_user_name_from_email("dec05eba@domain.com"), "dec05eba");
+ assert_equals(extract_user_name_from_email("@dec05eba:domain.com"), "");
+ assert_equals(extract_user_name_from_email("dec05eba"), "");
+
return 0;
}