wharmby Sun Jun 21 17:42:16 2009 UTC
Added files: (Branch: PHP_5_2)
/php-src/tests/lang this_assignment.phpt passByReference_012.phpt
string_decimals_001.phpt
Log:
New lang tests.
http://cvs.php.net/viewvc.cgi/php-src/tests/lang/this_assignment.phpt?view=markup&rev=1.1
Index: php-src/tests/lang/this_assignment.phpt
+++ php-src/tests/lang/this_assignment.phpt
--TEST--
Test to catch early assignment of $this
--FILE--
<?php
class first {
function me() { echo "first"; }
function who() {
global $a,$b;
$this->me();
$a->me();
$b->me();
$b = new second();
$this->me();
$a->me();
$b->me();
}
}
class second {
function who() {
global $a,$b;
$this->me();
$a->me();
$b->me();
}
function me() { echo "second"; }
}
$a = new first();
$b = &$a;
$a->who();
$b->who();
echo "\n";
?>
===DONE===
--EXPECT--
firstfirstfirstfirstsecondsecondsecondsecondsecond
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/tests/lang/passByReference_012.phpt?view=markup&rev=1.1
Index: php-src/tests/lang/passByReference_012.phpt
+++ php-src/tests/lang/passByReference_012.phpt
--TEST--
Test pass by reference semantics
--FILE--
<?php
error_reporting(E_ALL | E_STRICT | E_NOTICE);
// Simplified array_shift_variation5.phpt
// Showing warning:
// "Only variables should be passed by reference in %s on line %d"
$stack = array ( array ( 'two' ));
var_dump(array_shift(array_shift($stack)));
// This should show the identical warning
$original = array ( array ( 'one' ));
$stack = $original;
var_dump(array_shift(array_shift($stack)));
?>
===DONE===
--EXPECTF--
Strict Standards: Only variables should be passed by reference in %s on line %d
unicode(3) "two"
Strict Standards: Only variables should be passed by reference in %s on line %d
unicode(3) "one"
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/tests/lang/string_decimals_001.phpt?view=markup&rev=1.1
Index: php-src/tests/lang/string_decimals_001.phpt
+++ php-src/tests/lang/string_decimals_001.phpt
--TEST--
String conversion with multiple decimal points
--FILE--
<?php
function test($str) {
echo "\n--> Testing $str:\n";
var_dump((int)$str);
var_dump((float)$str);
var_dump($str > 0);
}
test("..9");
test(".9.");
test("9..");
test("9.9.");
test("9.9.9");
?>
===DONE===
--EXPECTF--
--> Testing ..9:
int(0)
float(0)
bool(false)
--> Testing .9.:
int(0)
float(0.9)
bool(true)
--> Testing 9..:
int(9)
float(9)
bool(true)
--> Testing 9.9.:
int(9)
float(9.9)
bool(true)
--> Testing 9.9.9:
int(9)
float(9.9)
bool(true)
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php