summaryrefslogtreecommitdiff
path: root/tests/unit/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2016-10-02 08:58:19 +0200
committerSébastien Helleu <flashcode@flashtux.org>2016-10-02 08:58:19 +0200
commit54841f6294380c023f586598b672816f36a1adc3 (patch)
treeca468a6af023ce148e15a9f0f558d3e0b47ffcf0 /tests/unit/core
parentf98d50ebab5c2a47da7b368ee219547638892e59 (diff)
downloadweechat-54841f6294380c023f586598b672816f36a1adc3.zip
api: fix return of function string_match() when there are multiple masks in the string (issue #812)
Some tests are added as well to test the multiple masks in the string.
Diffstat (limited to 'tests/unit/core')
-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 fb1d06ddb..34c31793d 100644
--- a/tests/unit/core/test-string.cpp
+++ b/tests/unit/core/test-string.cpp
@@ -322,6 +322,24 @@ TEST(String, Match)
LONGS_EQUAL(1, string_match ("test", "*es*", 1));
LONGS_EQUAL(1, string_match ("test", "*ES*", 0));
LONGS_EQUAL(0, string_match ("test", "*ES*", 1));
+ LONGS_EQUAL(1, string_match ("TEST", "*es*", 0));
+ LONGS_EQUAL(0, string_match ("TEST", "*es*", 1));
+ LONGS_EQUAL(0, string_match ("aaba", "*aa", 0));
+ LONGS_EQUAL(0, string_match ("aaba", "*aa", 1));
+ LONGS_EQUAL(1, string_match ("abaa", "*aa", 0));
+ LONGS_EQUAL(1, string_match ("abaa", "*aa", 1));
+ LONGS_EQUAL(1, string_match ("aabaa", "*aa", 0));
+ LONGS_EQUAL(1, string_match ("aabaa", "*aa", 1));
+ LONGS_EQUAL(1, string_match ("aabaabaabaa", "*aa", 0));
+ LONGS_EQUAL(1, string_match ("aabaabaabaa", "*aa", 1));
+ LONGS_EQUAL(0, string_match ("abaa", "aa*", 0));
+ LONGS_EQUAL(0, string_match ("abaa", "aa*", 1));
+ LONGS_EQUAL(1, string_match ("aaba", "aa*", 0));
+ LONGS_EQUAL(1, string_match ("aaba", "aa*", 1));
+ LONGS_EQUAL(1, string_match ("aabaa", "aa*", 0));
+ LONGS_EQUAL(1, string_match ("aabaa", "aa*", 1));
+ LONGS_EQUAL(1, string_match ("aabaabaabaa", "aa*", 0));
+ LONGS_EQUAL(1, string_match ("aabaabaabaa", "aa*", 1));
}
/*