summaryrefslogtreecommitdiff
path: root/tests/unit/core/test-string.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-10-09 21:12:02 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-10-09 21:12:02 +0200
commit8da3458f4cb6c806dc399bf828f97ad60dadaf1d (patch)
tree0971f7567b96e247047a0a4bc4e022c1e9e356e1 /tests/unit/core/test-string.cpp
parent82697714e1b51968dc852c9194deb2e0bf159596 (diff)
downloadweechat-8da3458f4cb6c806dc399bf828f97ad60dadaf1d.zip
core: add repeat of string in evaluation of expressions with "repeat:count,string" (closes #958)
Diffstat (limited to 'tests/unit/core/test-string.cpp')
-rw-r--r--tests/unit/core/test-string.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/core/test-string.cpp b/tests/unit/core/test-string.cpp
index d58bebabf..7fcc0ed7a 100644
--- a/tests/unit/core/test-string.cpp
+++ b/tests/unit/core/test-string.cpp
@@ -294,6 +294,24 @@ TEST(CoreString, Reverse)
/*
* Tests functions:
+ * string_repeat
+ */
+
+TEST(CoreString, Repeat)
+{
+ POINTERS_EQUAL(NULL, string_repeat (NULL, 1));
+ STRCMP_EQUAL("", string_repeat ("", 1));
+
+ STRCMP_EQUAL("", string_repeat ("x", -1));
+ STRCMP_EQUAL("", string_repeat ("x", 0));
+ STRCMP_EQUAL("x", string_repeat ("x", 1));
+ STRCMP_EQUAL("xxx", string_repeat ("x", 3));
+ STRCMP_EQUAL("abcabc", string_repeat ("abc", 2));
+ STRCMP_EQUAL("noëlnoël", string_repeat ("noël", 2));
+}
+
+/*
+ * Tests functions:
* string_strcasecmp
* string_strncasecmp
* string_strcasecmp_range