summaryrefslogtreecommitdiff
path: root/tests/it.t
diff options
context:
space:
mode:
authorNathan Gass2012-03-26 15:20:24 +0000
committerNathan Gass2012-03-26 15:20:24 +0000
commit0147e6e3aea620a54b0c3f6c932c658ee72a45a0 (patch)
treebe3570287efdba1219dd1150439e4f739bd95f7a /tests/it.t
parentbbcc6615dc5316a73f07b262950ac18d50c80497 (diff)
downloaditools-0147e6e3aea620a54b0c3f6c932c658ee72a45a0.tar.gz
itools-0147e6e3aea620a54b0c3f6c932c658ee72a45a0.tar.bz2
itools-0147e6e3aea620a54b0c3f6c932c658ee72a45a0.zip
new utf8 safe functions it::grep and it::substr_replace
Diffstat (limited to 'tests/it.t')
-rwxr-xr-xtests/it.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/it.t b/tests/it.t
index ec95cc4..317b8a3 100755
--- a/tests/it.t
+++ b/tests/it.t
@@ -305,6 +305,10 @@ is(it::replace(array('#' => "!", '\w' => "x"), "#ö"), "!x");
is(it::replace(array('ö' => "x"), "Ö"), "x");
is(it::replace(array('a' => "1"), "aaa", array('limit' => 1)), "1aa");
+is(it::grep('ismatch', array('ismatch', 'isnomatch')), array('ismatch'), 'grep with simple regex');
+is(it::grep('!', array('ismatch!', 'isnomatch')), array('ismatch!'), '! in regex');
+is(it::grep('lower|UPPER', array('lower', 'LOWER', 'upper', 'UPPER'), 'casesensitive' => 1), array(0 => 'lower', 3 => 'UPPER'), 'set casesensitive');
+is(it::grep('match', array('foo' => 'match', 'bar' => 'gna')), array('foo' => 'match'), 'with keys');
setlocale(LC_CTYPE, $oldlocale);
ini_set('default_charset', $oldcharset); # end of tests that must run with specific charset
@@ -342,4 +346,8 @@ is(it::date('datetime', 1000000.543), it::date('datetime', "1000000"), '... larg
is(it::date('time', "10.5"), "10:05", 'interpret string with points with strtotime');
is(it::date('time', "10.05"), "10:05", 'interpret string with points with strtotime');
+# 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');
+
?>