diff options
author | Christian Schneider | 2020-09-15 13:20:03 +0200 |
---|---|---|
committer | Christian Schneider | 2020-09-15 13:20:03 +0200 |
commit | 79fd50e172a50918d9018f54ab6e40606181f95b (patch) | |
tree | c3292f632de47c825d16c55ca51a00ce68b4b3a4 /test/it.t | |
parent | f42d056812d4c1766d75bd8ab6d871e06a700302 (diff) | |
download | itools-79fd50e172a50918d9018f54ab6e40606181f95b.tar.gz itools-79fd50e172a50918d9018f54ab6e40606181f95b.tar.bz2 itools-79fd50e172a50918d9018f54ab6e40606181f95b.zip |
Make itools PHP 8 compatible
Diffstat (limited to 'test/it.t')
-rwxr-xr-x | test/it.t | 82 |
1 files changed, 41 insertions, 41 deletions
@@ -12,7 +12,7 @@ $oldlocale = setlocale(LC_CTYPE, 0); ini_set('default_charset', 'utf-8'); setlocale(LC_CTYPE, 'de_CH'); # required becuase we're checking German umlauts in latin1 mode -function match($regex, $string, $expect, $name, $p = []) +function _match($regex, $string, $expect, $name, $p = []) { $GLOBALS['TEST_MORE_LEVEL'] = 1; $pass = is (it::match($regex, $string, $p), $expect, $name); @@ -24,103 +24,103 @@ function match($regex, $string, $expect, $name, $p = []) } -match( +_match( 'b', 'aaaabaaaa', 'b', 'simple regex' ); -match( +_match( 'a/b', ' a/b ', 'a/b', 'regex with /' ); -match( +_match( 'aa(bb)aa(cc)aa(dd)qq', 'aabbaaccaaddqq', ['bb', 'cc', 'dd'], 'return array of captures' ); -match( +_match( '\bblah\b', ' blah ', 'blah', 'match \b at spaces' ); -match( +_match( '\bblah\b', 'blah', 'blah', 'match \b at end of string' ); -match( +_match( '\bblah\b', 'ablahc', null, 'don\'t match \b at word chars' ); -match( +_match( '\bblah\b', 'Üblahä', null, 'don\'t match \b at umlaute' ); -match( +_match( '\Bblah\B', ' blah ', null, 'don\'t match \B at spaces' ); -match( +_match( '\Bblah\B', 'blah', null, 'don\'t match \B at end of string' ); -match( +_match( '\Bblah\B', 'ablahc', 'blah', 'match \B at word chars' ); -match( +_match( '\Bblah\B', 'Üblahä', 'blah', 'match \B at umlaute' ); -match( +_match( '\w+', ' |#Üblahä ', 'Üblahä', 'include umlaute in \w' ); -match( +_match( '[[:alpha:]]+', ' |#blahä ', 'blahä', 'include umlaute in [[:alpha:]]' ); -match( +_match( '\W+', ' |#Üblahä ', ' |#', 'don\'t include umlaute in \W' ); -match( +_match( '\ba', 'äa', null, '\b must know umlauts' ); -match( +_match( 'aaa\\\\w+', ' aaa\www ', 'aaa\www', 'don\'t parse \w in \\\\w at beginning (match)' ); -match( +_match( 'aaa\\\\w+', ' aaa\www ', 'aaa\www', 'don\'t parse \w in \\\\w after chars (match)' @@ -129,105 +129,105 @@ match( eval('$escapedwordregex = "' . it::convertregex('\w') . '";'); $escapedwordregex = preg_replace('|[\\\\/]|', '', $escapedwordregex); -match( +_match( '\\\\w+', $escapedwordregex, null, 'don\'t parse \w in \\\\w at beginning (no match)' ); -match( +_match( 'aaa\\\\w+', 'aaa' . $escapedwordregex, null, 'don\'t parse \w in \\\\w after chars (no match)' ); -match( +_match( '\\\\\\\\w+', '\\' . $escapedwordregex, null, 'don\'t parse \w in \\\\\\\w (no match)' ); -match( +_match( '\\\\\\\\w+', ' \\\\www ', '\\\\www', 'don\'t parse \\\\\\\\w as \w (match)' ); -match( +_match( '[\w]+', '[[[]]]---', null, 'replace \w in [\w] correctly (no match)' ); -match( +_match( '[\w]+', ' \\\\aword[[[]]] ', 'aword', 'replace \w in [\w] correctly (match)' ); -match( +_match( '[\\\\w]+', ' blabergna ', null, 'don\'t parse \w in [\\\\w] (no match)' ); -match( +_match( '[\\\\w]+', ' \\\\worda[[[]', '\\\\w', 'don\'t parse \w in [\\\\w] (match)' ); -match( +_match( '[a\W]+', 'bbbbbbb a a%$+ accccc', ' a a%$+ a', '\W in []' ); -match( +_match( '\\\\\\w+', ' \Üblahä ', '\Üblahä', 'parse \w in \\\\\\w at beginning' ); -match( +_match( 'aaa\\\\\\w+', ' aaa\Üblahä ', 'aaa\Üblahä', 'parse \w in \\\\\\w after chars' ); -match( +_match( '\w+', 'word1 wörd2 word_3', ['word1', 'wörd2', 'word_3'], "test match_all function", ['all' => true] ); -match( +_match( 'aBcD', ' aBcD ', 'aBcD', "caseinsensitive is default" ); -match( +_match( '\w+', 'Müller', 'Müller', '\w matches umlaut in utf-8 mode' ); -match( +_match( 'M.ller', 'Müller', 'Müller', '. matches umlaut in utf-8 mode' ); -match( +_match( utf8_decode('ö'), utf8_decode('Ö'), utf8_decode('Ö'), 'match umlaute in de_CH.latin1 case insensitive', ['utf8' => false] ); -match( +_match( utf8_decode('aöBÜ'), utf8_decode('AÖbü'), utf8_decode('AÖbü'), "match umlaute with non-utf-8 override in p", @@ -235,35 +235,35 @@ match( ); -match( +_match( 'abc', "aBc", null, "set case sensitivity by parameter", ['casesensitive' => 1] ); -match( +_match( '\w+', 'word1 wörd2 word_3', ['word1', 'wörd2', 'word_3'], "test all => 1 without captures", ['all' => 1] ); -match( +_match( '\w+\s+(\d+)', 'word1 12 wörd2 3 word_3 4', ['12', '3', '4'], "test all => 1 with one capture", ['all' => 1] ); -match( +_match( '(\w+)\s+(\d+)', 'word1 12 wörd2 3 word_3 4', [['word1', '12'], ['wörd2', '3'], ['word_3', '4']], "test all => 1 with captures", ['all' => 1] ); -match( +_match( '(\w+)\s+(\d+)', 'word1 12 wörd2 3 word_3 4', [['word1', 'wörd2', 'word_3'], ['12', '3', '4']], "test all => 1,pattern_order => 1", @@ -271,7 +271,7 @@ match( ); ini_set('default_charset', 'iso-8859-1'); -match( +_match( 'aöBÜ', "AÖbü", 'AÖbü', "match utf-8 umlaute in case insensitive mode with utf8 override", |