Browse Source

New lang tests.

experimental/first_unicode_implementation
andy wharmby 17 years ago
parent
commit
46a0a90400
  1. 25
      tests/lang/passByReference_012.phpt
  2. 45
      tests/lang/string_decimals_001.phpt
  3. 43
      tests/lang/this_assignment.phpt

25
tests/lang/passByReference_012.phpt

@ -0,0 +1,25 @@
--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===

45
tests/lang/string_decimals_001.phpt

@ -0,0 +1,45 @@
--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===

43
tests/lang/this_assignment.phpt

@ -0,0 +1,43 @@
--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===
Loading…
Cancel
Save