nlopess         Sun Jul 16 19:36:23 2006 UTC

  Modified files:              
    /php-src/ext/pcre/tests     grep2.phpt split.phpt split2.phpt 
  Log:
  MFB
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/grep2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/grep2.phpt
diff -u /dev/null php-src/ext/pcre/tests/grep2.phpt:1.2
--- /dev/null   Sun Jul 16 19:36:23 2006
+++ php-src/ext/pcre/tests/grep2.phpt   Sun Jul 16 19:36:23 2006
@@ -0,0 +1,45 @@
+--TEST--
+preg_grep() 2nd test
+--FILE--
+<?php
+
+var_dump(preg_grep(1,array(),3,4));
+var_dump(preg_grep(1, 2));
+var_dump(preg_grep('/+/', array()));
+
+$array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20');
+
+var_dump(preg_grep('@^[a-z]+@', $array));
+var_dump(preg_grep('@^[a-z]+@', $array, PREG_GREP_INVERT));
+
+ini_set('pcre.recursion_limit', 1);
+var_dump(preg_last_error() == PREG_NO_ERROR);
+var_dump(preg_grep('@^[a-z]+@', $array));
+var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
+
+?>
+--EXPECTF--
+Warning: Wrong parameter count for preg_grep() in %sgrep2.php on line 3
+NULL
+
+Warning: preg_grep(): Second argument to preg_grep() should be an array in 
%sgrep2.php on line 4
+NULL
+
+Warning: preg_grep(): Compilation failed: nothing to repeat at offset 0 in 
%sgrep2.php on line 5
+bool(false)
+array(3) {
+  [5]=>
+  string(1) "a"
+  ["xyz"]=>
+  string(2) "q6"
+  [6]=>
+  string(3) "h20"
+}
+array(1) {
+  ["x"]=>
+  string(1) "1"
+}
+bool(true)
+array(0) {
+}
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/split.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/split.phpt
diff -u /dev/null php-src/ext/pcre/tests/split.phpt:1.2
--- /dev/null   Sun Jul 16 19:36:23 2006
+++ php-src/ext/pcre/tests/split.phpt   Sun Jul 16 19:36:23 2006
@@ -0,0 +1,86 @@
+--TEST--
+preg_split()
+--FILE--
+<?php
+
+var_dump(preg_split());
+var_dump(preg_split('/*/', 'x'));
+
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz'));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', -1));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 0));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 1));
+var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 2));
+
+var_dump(preg_split('/\d*/', 'ab2c3u'));
+var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY));
+
+?>
+--EXPECTF--
+Warning: Wrong parameter count for preg_split() in %ssplit.php on line 3
+NULL
+
+Warning: preg_split(): Compilation failed: nothing to repeat at offset 0 in 
%ssplit.php on line 4
+bool(false)
+array(3) {
+  [0]=>
+  string(1) "x"
+  [1]=>
+  string(2) "yy"
+  [2]=>
+  string(3) "zzz"
+}
+array(3) {
+  [0]=>
+  string(1) "x"
+  [1]=>
+  string(2) "yy"
+  [2]=>
+  string(3) "zzz"
+}
+array(3) {
+  [0]=>
+  string(1) "x"
+  [1]=>
+  string(2) "yy"
+  [2]=>
+  string(3) "zzz"
+}
+array(1) {
+  [0]=>
+  string(8) "x yy,zzz"
+}
+array(2) {
+  [0]=>
+  string(1) "x"
+  [1]=>
+  string(6) "yy,zzz"
+}
+array(8) {
+  [0]=>
+  string(0) ""
+  [1]=>
+  string(1) "a"
+  [2]=>
+  string(1) "b"
+  [3]=>
+  string(0) ""
+  [4]=>
+  string(1) "c"
+  [5]=>
+  string(0) ""
+  [6]=>
+  string(1) "u"
+  [7]=>
+  string(0) ""
+}
+array(4) {
+  [0]=>
+  string(1) "a"
+  [1]=>
+  string(1) "b"
+  [2]=>
+  string(1) "c"
+  [3]=>
+  string(1) "u"
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/split2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pcre/tests/split2.phpt
diff -u /dev/null php-src/ext/pcre/tests/split2.phpt:1.2
--- /dev/null   Sun Jul 16 19:36:23 2006
+++ php-src/ext/pcre/tests/split2.phpt  Sun Jul 16 19:36:23 2006
@@ -0,0 +1,315 @@
+--TEST--
+preg_split() 2nd test
+--FILE--
+<?php
+
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_OFFSET_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_DELIM_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_OFFSET_CAPTURE));;
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | 
PREG_SPLIT_OFFSET_CAPTURE));
+var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
+
+
+var_dump(preg_last_error(1));
+ini_set('pcre.recursion_limit', 1);
+var_dump(preg_last_error() == PREG_NO_ERROR);
+var_dump(preg_split('/(\d*)/', 'ab2c3u'));
+var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
+
+?>
+--EXPECTF--
+array(15) {
+  [0]=>
+  string(0) ""
+  [1]=>
+  string(0) ""
+  [2]=>
+  string(1) "a"
+  [3]=>
+  string(0) ""
+  [4]=>
+  string(1) "b"
+  [5]=>
+  string(1) "2"
+  [6]=>
+  string(0) ""
+  [7]=>
+  string(0) ""
+  [8]=>
+  string(1) "c"
+  [9]=>
+  string(1) "3"
+  [10]=>
+  string(0) ""
+  [11]=>
+  string(0) ""
+  [12]=>
+  string(1) "u"
+  [13]=>
+  string(0) ""
+  [14]=>
+  string(0) ""
+}
+array(8) {
+  [0]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(0)
+  }
+  [1]=>
+  array(2) {
+    [0]=>
+    string(1) "a"
+    [1]=>
+    int(0)
+  }
+  [2]=>
+  array(2) {
+    [0]=>
+    string(1) "b"
+    [1]=>
+    int(1)
+  }
+  [3]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(3)
+  }
+  [4]=>
+  array(2) {
+    [0]=>
+    string(1) "c"
+    [1]=>
+    int(3)
+  }
+  [5]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(5)
+  }
+  [6]=>
+  array(2) {
+    [0]=>
+    string(1) "u"
+    [1]=>
+    int(5)
+  }
+  [7]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(6)
+  }
+}
+array(6) {
+  [0]=>
+  string(1) "a"
+  [1]=>
+  string(1) "b"
+  [2]=>
+  string(1) "2"
+  [3]=>
+  string(1) "c"
+  [4]=>
+  string(1) "3"
+  [5]=>
+  string(1) "u"
+}
+array(4) {
+  [0]=>
+  array(2) {
+    [0]=>
+    string(1) "a"
+    [1]=>
+    int(0)
+  }
+  [1]=>
+  array(2) {
+    [0]=>
+    string(1) "b"
+    [1]=>
+    int(1)
+  }
+  [2]=>
+  array(2) {
+    [0]=>
+    string(1) "c"
+    [1]=>
+    int(3)
+  }
+  [3]=>
+  array(2) {
+    [0]=>
+    string(1) "u"
+    [1]=>
+    int(5)
+  }
+}
+array(15) {
+  [0]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(0)
+  }
+  [1]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(0)
+  }
+  [2]=>
+  array(2) {
+    [0]=>
+    string(1) "a"
+    [1]=>
+    int(0)
+  }
+  [3]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(1)
+  }
+  [4]=>
+  array(2) {
+    [0]=>
+    string(1) "b"
+    [1]=>
+    int(1)
+  }
+  [5]=>
+  array(2) {
+    [0]=>
+    string(1) "2"
+    [1]=>
+    int(2)
+  }
+  [6]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(3)
+  }
+  [7]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(3)
+  }
+  [8]=>
+  array(2) {
+    [0]=>
+    string(1) "c"
+    [1]=>
+    int(3)
+  }
+  [9]=>
+  array(2) {
+    [0]=>
+    string(1) "3"
+    [1]=>
+    int(4)
+  }
+  [10]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(5)
+  }
+  [11]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(5)
+  }
+  [12]=>
+  array(2) {
+    [0]=>
+    string(1) "u"
+    [1]=>
+    int(5)
+  }
+  [13]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(6)
+  }
+  [14]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    int(6)
+  }
+}
+array(6) {
+  [0]=>
+  array(2) {
+    [0]=>
+    string(1) "a"
+    [1]=>
+    int(0)
+  }
+  [1]=>
+  array(2) {
+    [0]=>
+    string(1) "b"
+    [1]=>
+    int(1)
+  }
+  [2]=>
+  array(2) {
+    [0]=>
+    string(1) "2"
+    [1]=>
+    int(2)
+  }
+  [3]=>
+  array(2) {
+    [0]=>
+    string(1) "c"
+    [1]=>
+    int(3)
+  }
+  [4]=>
+  array(2) {
+    [0]=>
+    string(1) "3"
+    [1]=>
+    int(4)
+  }
+  [5]=>
+  array(2) {
+    [0]=>
+    string(1) "u"
+    [1]=>
+    int(5)
+  }
+}
+
+Warning: preg_last_error() expects exactly 0 parameters, 1 given in 
/cvs/php5/ext/pcre/tests/split2.php on line 11
+NULL
+bool(true)
+array(1) {
+  [0]=>
+  string(6) "ab2c3u"
+}
+bool(true)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to