From f5587447852d06f5d937ccfa71c7707451173e52 Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Sun, 21 Jun 2009 17:42:16 +0000 Subject: [PATCH] New lang tests. --- tests/lang/passByReference_012.phpt | 26 +++++++++++++++++ tests/lang/string_decimals_001.phpt | 45 +++++++++++++++++++++++++++++ tests/lang/this_assignment.phpt | 43 +++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 tests/lang/passByReference_012.phpt create mode 100644 tests/lang/string_decimals_001.phpt create mode 100644 tests/lang/this_assignment.phpt diff --git a/tests/lang/passByReference_012.phpt b/tests/lang/passByReference_012.phpt new file mode 100644 index 0000000000..3f80799c93 --- /dev/null +++ b/tests/lang/passByReference_012.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test pass by reference semantics +--FILE-- + +===DONE=== +--EXPECTF-- +Strict Standards: Only variables should be passed by reference in %s on line %d +string(3) "two" + +Strict Standards: Only variables should be passed by reference in %s on line %d +string(3) "one" +===DONE=== + \ No newline at end of file diff --git a/tests/lang/string_decimals_001.phpt b/tests/lang/string_decimals_001.phpt new file mode 100644 index 0000000000..3a509b24bb --- /dev/null +++ b/tests/lang/string_decimals_001.phpt @@ -0,0 +1,45 @@ +--TEST-- +String conversion with multiple decimal points +--FILE-- + 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=== \ No newline at end of file diff --git a/tests/lang/this_assignment.phpt b/tests/lang/this_assignment.phpt new file mode 100644 index 0000000000..7158a34c20 --- /dev/null +++ b/tests/lang/this_assignment.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test to catch early assignment of $this +--FILE-- +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=== \ No newline at end of file -- 2.40.0