1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +02:00

core: add reverse of string in evaluation of expressions with "rev:" (closes #1200)

This commit is contained in:
Sébastien Helleu
2018-06-02 15:48:31 +02:00
parent ab9a0ec2e6
commit 1abf4040f1
30 changed files with 425 additions and 295 deletions
+24
View File
@@ -268,6 +268,30 @@ TEST(String, Cut)
STRCMP_EQUAL("こ…", string_cut ("こんにちは世界", 3, 1, 1, ""));
}
/*
* Tests functions:
* string_reverse
*/
TEST(String, Reverse)
{
POINTERS_EQUAL(NULL, string_reverse (NULL));
STRCMP_EQUAL("", string_reverse (""));
/* reverse of UTF-8 string */
STRCMP_EQUAL("n", string_reverse ("n"));
STRCMP_EQUAL("on", string_reverse ("no"));
STRCMP_EQUAL("ëon", string_reverse ("noë"));
STRCMP_EQUAL("lëon", string_reverse ("noël"));
STRCMP_EQUAL("界世はちにんこ", string_reverse ("こんにちは世界"));
/*
* reverse of ISO-8859-15 string: the result may not be what you expect:
* the function string_reverse accepts only an UTF-8 string as input
*/
STRCMP_EQUAL("\xeblon", string_reverse ("no\xebl"));
}
/*
* Tests functions:
* string_strcasecmp