Skip to content

Commit 56b4e8c

Browse files
author
gitlost
committed
Tools tests.
1 parent 70f70e2 commit 56b4e8c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/toolsTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,26 @@ function test_list_pluck() {
149149
$out = unfc_list_pluck( $list, 'id' );
150150
$this->assertSame( array( 0 => 1, 1 => 2, 3 => 4 ), $out );
151151
}
152+
153+
/**
154+
* @ticket unfc_utf8_ranges
155+
*/
156+
function test_utf8_ranges() {
157+
$arr = array(
158+
/**/
159+
array( 0, 0xa, '[\x00-\x0a]' ),
160+
array( 0x80, 0x85, '\xc2[\x80-\x85]' ),
161+
array( 0x800, 0x850, '\xe0(?:\xa0[\x80-\xbf]|\xa1[\x80-\x90])' ),
162+
array( 0x10000, 0x10040, '\xf0\x90(?:\x80[\x80-\xbf]|\x81\x80)' ),
163+
/**/
164+
);
165+
166+
foreach ( $arr as $item ) {
167+
list( $c1, $c2, $expected ) = $item;
168+
$ranges = array();
169+
unfc_utf8_ranges( $ranges, $c1, $c2 );
170+
$actual = unfc_utf8_regex_alts( $ranges );
171+
$this->assertSame( $expected, $actual );
172+
}
173+
}
152174
}

0 commit comments

Comments
 (0)