Added test cases to check the compatibility with standard ereg functions.

This commit is contained in:
Moriyoshi Koizumi 2002-10-29 19:01:10 +00:00
parent 066e8aeef6
commit fc0e6ff90e
16 changed files with 176 additions and 0 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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 +-|=

View 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

View 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

View 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

View 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\

View 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

View 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

View 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

View 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