mirror of
https://github.com/php/php-src.git
synced 2024-12-12 19:33:31 +08:00
Added test cases to check the compatibility with standard ereg functions.
This commit is contained in:
parent
066e8aeef6
commit
fc0e6ff90e
16
ext/mbstring/tests/mb_ereg-compat-01.phpt
Normal file
16
ext/mbstring/tests/mb_ereg-compat-01.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
mb_ereg() compatibility test 1 (counterpart: ext/standard/tests/reg/004.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="This is a nice and simple string";
|
||||
if (mb_ereg(".*nice and simple.*",$a)) {
|
||||
echo "ok\n";
|
||||
}
|
||||
if (!mb_ereg(".*doesn't exist.*",$a)) {
|
||||
echo "ok\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
ok
|
20
ext/mbstring/tests/mb_ereg-compat-02.phpt
Normal file
20
ext/mbstring/tests/mb_ereg-compat-02.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
mb_ereg() compatibility test 2 (counterpart: ext/standard/tests/reg/005.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="This is a nice and simple string";
|
||||
echo mb_ereg(".*(is).*(is).*",$a,$registers);
|
||||
echo "\n";
|
||||
echo $registers[0];
|
||||
echo "\n";
|
||||
echo $registers[1];
|
||||
echo "\n";
|
||||
echo $registers[2];
|
||||
echo "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
32
|
||||
This is a nice and simple string
|
||||
is
|
||||
is
|
9
ext/mbstring/tests/mb_ereg_replace-compat-01.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-01.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 1 (counterpart: ext/standard/tests/reg/001.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="abc123";
|
||||
echo mb_ereg_replace("123","def",$a)?>
|
||||
--EXPECT--
|
||||
abcdef
|
9
ext/mbstring/tests/mb_ereg_replace-compat-02.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-02.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 2 (counterpart: ext/standard/tests/reg/002.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="abc123";
|
||||
echo mb_ereg_replace("123","",$a)?>
|
||||
--EXPECT--
|
||||
abc
|
10
ext/mbstring/tests/mb_ereg_replace-compat-03.phpt
Normal file
10
ext/mbstring/tests/mb_ereg_replace-compat-03.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 3 (counterpart: ext/standard/tests/reg/003.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="\\'test";
|
||||
echo mb_ereg_replace("\\\\'","'",$a)
|
||||
?>
|
||||
--EXPECT--
|
||||
'test
|
10
ext/mbstring/tests/mb_ereg_replace-compat-04.phpt
Normal file
10
ext/mbstring/tests/mb_ereg_replace-compat-04.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 4 (counterpart: ext/standard/tests/reg/006.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="This is a nice and simple string";
|
||||
echo mb_ereg_replace("^This","That",$a);
|
||||
?>
|
||||
--EXPECT--
|
||||
That is a nice and simple string
|
12
ext/mbstring/tests/mb_ereg_replace-compat-05.phpt
Normal file
12
ext/mbstring/tests/mb_ereg_replace-compat-05.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 5 (counterpart: ext/standard/tests/reg/007.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
$a="abcd";
|
||||
$b=mb_ereg_replace("abcd","",$a);
|
||||
echo "strlen(\$b)=".strlen($b);
|
||||
?>
|
||||
--EXPECT--
|
||||
strlen($b)=0
|
10
ext/mbstring/tests/mb_ereg_replace-compat-06.phpt
Normal file
10
ext/mbstring/tests/mb_ereg_replace-compat-06.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 6 (counterpart: ext/standard/tests/reg/008.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
echo mb_ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
|
||||
?>
|
||||
--EXPECT--
|
||||
123 abc +-|=
|
9
ext/mbstring/tests/mb_ereg_replace-compat-07.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-07.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 7 (counterpart: ext/standard/tests/reg/010.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="abc122222222223";
|
||||
echo mb_ereg_replace("1(2*)3","\\1def\\1",$a)?>
|
||||
--EXPECT--
|
||||
abc2222222222def2222222222
|
9
ext/mbstring/tests/mb_ereg_replace-compat-08.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-08.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 8 (counterpart: ext/standard/tests/reg/011.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="abc123";
|
||||
echo mb_ereg_replace("123","def\\0ghi",$a)?>
|
||||
--EXPECT--
|
||||
abcdef123ghi
|
9
ext/mbstring/tests/mb_ereg_replace-compat-09.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-09.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 9 (counterpart: ext/standard/tests/reg/012.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="abc123";
|
||||
echo mb_ereg_replace("123",'def\1ghi',$a)?>
|
||||
--EXPECT--
|
||||
abcdef\1ghi
|
9
ext/mbstring/tests/mb_ereg_replace-compat-10.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-10.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 10 (counterpart: ext/standard/tests/reg/013.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="abc123";
|
||||
echo mb_ereg_replace("123","def\\g\\\\hi\\",$a)?>
|
||||
--EXPECT--
|
||||
abcdef\g\\hi\
|
9
ext/mbstring/tests/mb_ereg_replace-compat-11.phpt
Normal file
9
ext/mbstring/tests/mb_ereg_replace-compat-11.phpt
Normal file
@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 11 (counterpart: ext/standard/tests/reg/014.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php $a="a\\2bxc";
|
||||
echo mb_ereg_replace("a(.*)b(.*)c","\\1",$a)?>
|
||||
--EXPECT--
|
||||
\2
|
8
ext/mbstring/tests/mb_ereg_replace-compat-12.phpt
Normal file
8
ext/mbstring/tests/mb_ereg_replace-compat-12.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 12 (counterpart: ext/standard/tests/reg/015.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php echo mb_ereg_replace("^","z","abc123")?>
|
||||
--EXPECT--
|
||||
zabc123
|
8
ext/mbstring/tests/mb_ereg_replace-compat-13.phpt
Normal file
8
ext/mbstring/tests/mb_ereg_replace-compat-13.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
mb_ereg_replace() compatibility test 13 (counterpart: ext/standard/tests/reg/016.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php echo mb_ereg_replace('\?',"abc","?123?")?>
|
||||
--EXPECT--
|
||||
abc123abc
|
19
ext/mbstring/tests/mb_split-compat-01.phpt
Normal file
19
ext/mbstring/tests/mb_split-compat-01.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
mb_split() compatibility test 1 (counterpart: ext/standard/tests/reg/009.phpt)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
$a=mb_split("[[:space:]]","this is a
|
||||
test");
|
||||
echo count($a) . "\n";
|
||||
for ($i = 0; $i < count($a); $i++) {
|
||||
echo $a[$i] . "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
4
|
||||
this
|
||||
is
|
||||
a
|
||||
test
|
Loading…
Reference in New Issue
Block a user