diff options
author | Christian Weber | 2012-02-29 10:12:11 +0000 |
---|---|---|
committer | Christian Weber | 2012-02-29 10:12:11 +0000 |
commit | c0938f79a452c44e28fccc326775891ba6c743e3 (patch) | |
tree | 98db80457a9bb72f2c80621d3c36cbaa020b279a /tests | |
parent | 4d945c4a8ced3835064592f35ce2d68083e51b09 (diff) | |
download | itools-c0938f79a452c44e28fccc326775891ba6c743e3.tar.gz itools-c0938f79a452c44e28fccc326775891ba6c743e3.tar.bz2 itools-c0938f79a452c44e28fccc326775891ba6c743e3.zip |
it::convertregex() sets /u if default_charset is 'utf-8' (can be overridden)
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/it.t | 36 |
1 files changed, 31 insertions, 5 deletions
@@ -3,13 +3,13 @@ # Tests for it.class -function match( $regex, $string, $exp, $name ) +function match($regex, $string, $expect, $name) { $GLOBALS['TEST_MORE_LEVEL'] = 1; - $pass = is( it::match( $regex, $string ), $exp, $name ); - if( !$pass ) { - diag( " regex given: $regex" ); - diag( " regex converted: " . it::convertregex( $regex ) ); + $pass = is (it::match($regex, $string), $expect, $name); + if (!$pass) { + diag(" regex given: $regex"); + diag(" regex converted: " . it::convertregex($regex)); } $GLOBALS['TEST_MORE_LEVEL'] = 0; } @@ -183,6 +183,32 @@ match( 'Ö', 'match umlaute in latin1 case insensitive' ); + +is( + it::match(utf8_encode('aöBÜ'), utf8_encode("AÖbü"), array('utf8' => true)), + utf8_encode('AÖbü'), + "match utf-8 umlaute in case insensitive" +); + +$oldcharset = ini_get('default_charset'); +ini_set('default_charset', 'utf-8'); +match( + utf8_encode('aöBÜ'), utf8_encode('AÖbü'), + utf8_encode('AÖbü'), + "match utf-8 umlaute in case insensitive using default_charset" +); +is( + it::match('aöBÜ', 'AÖbü', array('utf8' => false)), + 'AÖbü', + "non-utf-8 override with default_charset=utf-8" +); +match( + '\w+', utf8_encode('Müller'), + utf8_encode('Müller'), + '\w matches umlaut in utf-8 mode' +); +ini_set('default_charset', $oldcharset); + is( it::match( 'abc', "aBc", array('casesensitive' => 1 )), false, |