summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Schneider2012-03-28 13:05:31 +0000
committerChristian Schneider2012-03-28 13:05:31 +0000
commit2c7860119626cdf65fa4d7de38b7e0a1fdb816df (patch)
tree65051611e9f605066ec28943b4db929d414b3ed0 /tests
parent52ced90c535518482618ff726eb5c512da40b203 (diff)
downloaditools-2c7860119626cdf65fa4d7de38b7e0a1fdb816df.tar.gz
itools-2c7860119626cdf65fa4d7de38b7e0a1fdb816df.tar.bz2
itools-2c7860119626cdf65fa4d7de38b7e0a1fdb816df.zip
Added tests for it::replace with nbsp, it::any2utf8
Diffstat (limited to 'tests')
-rwxr-xr-xtests/it.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/it.t b/tests/it.t
index 317b8a3..408d84a 100755
--- a/tests/it.t
+++ b/tests/it.t
@@ -304,6 +304,7 @@ is(it::replace(array('\w' => "x", '#' => "!"), "#ö"), "!x");
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::replace(array('\s' => "x"), it_html::entity_decode(" ")), "x", "match non-breaking space as white-space character");
is(it::grep('ismatch', array('ismatch', 'isnomatch')), array('ismatch'), 'grep with simple regex');
is(it::grep('!', array('ismatch!', 'isnomatch')), array('ismatch!'), '! in regex');
@@ -350,4 +351,18 @@ is(it::date('time', "10.05"), "10:05", 'interpret string with points with strtot
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::any2utf8('Meier'), 'Meier', "it::any2utf8 ascii input");
+is(it::any2utf8('Müller'), 'Müller', "it::any2utf8 utf8 input");
+is(it::any2utf8('Aslı'), 'Aslı', "it::any2utf8 utf8 non-latin1 input");
+is(it::any2utf8(utf8_decode('Müller')), 'Müller', "it::any2utf8 latin1 input");
+
+is(it::any2utf8(
+ ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'),
+ ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ',
+ "it::any2utf8 utf8 input (exhaustive alphabet)");
+is(it::any2utf8(
+ utf8_decode(' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ')),
+ ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ',
+ "it::any2utf8 latin1 input (exhaustive alphabet)");
+
?>