summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schneider2020-12-03 16:08:31 +0100
committerChristian Schneider2020-12-03 16:08:31 +0100
commitc997c6082ec2e47244ace87781d29c4766938197 (patch)
tree8305f31017373f6b8b74ff4dd62715618fb1f64d
parenta7f4311e91040e6510df5b559b6daa008497ab10 (diff)
downloaditools-c997c6082ec2e47244ace87781d29c4766938197.tar.gz
itools-c997c6082ec2e47244ace87781d29c4766938197.tar.bz2
itools-c997c6082ec2e47244ace87781d29c4766938197.zip
Add some tests for it::substr() behaviour we rely on which was broken for some PHP 8 Beta versions
-rwxr-xr-xtest/it.t4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/it.t b/test/it.t
index 49d5854..a3abf32 100755
--- a/test/it.t
+++ b/test/it.t
@@ -381,6 +381,10 @@ is(it::ucwords('foo bär über'), 'Foo Bär Über');
# it::substr_replace
is(it::substr_replace('abcdefgh', 'xyz', 2, 4), substr_replace('abcdefgh', 'xyz', 2, 4), 'it::substr_replace the same as substr_replace for ascii');
is(it::substr_replace('✔☯♥', '☃☃', 1, 1), '✔☃☃♥', 'it::substr_replace for utf-8');
+is(it::substr_replace('', 'xyz', 0, 0), substr_replace('', 'xyz', 0, 0), 'it::substr_replace with empty haystack the same as substr_replace');
+is(it::substr_replace('abc', 'xyz', 0, 2), substr_replace('abc', 'xyz', 0, 2), 'it::substr_replace replacing to end of haystack');
+is(it::substr_replace('abc', 'xyz', 0, 10), substr_replace('abc', 'xyz', 0, 10), 'it::substr_replace replacing past end of haystack');
+is(it::substr_replace('abcdefgh', 'xyz', 10, 4), substr_replace('abcdefgh', 'xyz', 10, 4), 'it::substr_replace outside of string');
is(grapheme_strlen("\xc1"), null, "need grapheme_strlen side effect for any2utf8");