cvs: php4 /tests/lang 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt 009.phpt 010.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.inc
016.phpt 017.phpt 022.phpt 025.phpt 029.phpt 030.phpt 031.phpt 033.phpt

From: Date: Fri, 29 Mar 2002 17:12:12 +0000
Subject: cvs: php4 /tests/lang 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt 009.phpt 010.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.inc
016.phpt 017.phpt 022.phpt 025.phpt 029.phpt 030.phpt 031.phpt 033.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10771@lists.php.net to get a copy of this message
sander Fri Mar 29 12:12:12 2002 EDT Added files: /php4/tests/lang 033.phpt Modified files: /php4/tests/lang 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt 009.phpt 010.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.inc 016.phpt 017.phpt 022.phpt 025.phpt 029.phpt 030.phpt 031.phpt Log: Updating tests: remove alternative syntax in tests, added a special alternative-syntax testfile.

Index: php4/tests/lang/002.phpt diff -u php4/tests/lang/002.phpt:1.1 php4/tests/lang/002.phpt:1.2 --- php4/tests/lang/002.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/002.phpt Fri Mar 29 12:12:11 2002 @@ -3,10 +3,12 @@ --POST-- --GET-- --FILE-- -<?php $a=1; - while($a<10): +<?php +$a=1; +while ($a<10) { echo $a; $a++; - endwhile?> +} +?> --EXPECT-- 123456789 Index: php4/tests/lang/003.phpt diff -u php4/tests/lang/003.phpt:1.1 php4/tests/lang/003.phpt:1.2 --- php4/tests/lang/003.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/003.phpt Fri Mar 29 12:12:11 2002 @@ -3,17 +3,19 @@ --POST-- --GET-- --FILE-- -<?php $a=1; - switch($a): - case 0; +<?php +$a=1; +switch($a) { + case 0: echo "bad"; break; - case 1; + case 1: echo "good"; break; - default; + default: echo "bad"; break; - endswitch?> +} +?> --EXPECT-- good Index: php4/tests/lang/004.phpt diff -u php4/tests/lang/004.phpt:1.1 php4/tests/lang/004.phpt:1.2 --- php4/tests/lang/004.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/004.phpt Fri Mar 29 12:12:11 2002 @@ -3,11 +3,13 @@ --POST-- --GET-- --FILE-- -<?php $a=1; - if($a==0): +<?php +$a=1; +if($a==0) { echo "bad"; - else: +} else { echo "good"; - endif?> +} +?> --EXPECT-- good Index: php4/tests/lang/005.phpt diff -u php4/tests/lang/005.phpt:1.1 php4/tests/lang/005.phpt:1.2 --- php4/tests/lang/005.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/005.phpt Fri Mar 29 12:12:11 2002 @@ -3,13 +3,16 @@ --POST-- --GET-- --FILE-- -<?php $a=1; - if($a==0): +<?php +$a=1; + +if($a==0) { echo "bad"; - elseif($a==3): +} elseif($a==3) { echo "bad"; - else: +} else { echo "good"; - endif?> +} +?> --EXPECT-- good Index: php4/tests/lang/006.phpt diff -u php4/tests/lang/006.phpt:1.1 php4/tests/lang/006.phpt:1.2 --- php4/tests/lang/006.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/006.phpt Fri Mar 29 12:12:11 2002 @@ -3,19 +3,23 @@ --POST-- --GET-- --FILE-- -<?php $a=1; $b=2; - if($a==0): +<?php +$a=1; +$b=2; + +if($a==0) { echo "bad"; - elseif($a==3): +} elseif($a==3) { echo "bad"; - else: - if($b==1): +} else { + if($b==1) { echo "bad"; - elseif($b==2): + } elseif($b==2) { echo "good"; - else: + } else { echo "bad"; - endif; - endif?> + } +} +?> --EXPECT-- good Index: php4/tests/lang/007.phpt diff -u php4/tests/lang/007.phpt:1.1 php4/tests/lang/007.phpt:1.2 --- php4/tests/lang/007.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/007.phpt Fri Mar 29 12:12:11 2002 @@ -3,23 +3,27 @@ --POST-- --GET-- --FILE-- -<?php error_reporting(0); - $a = 10; - function Test() - { - static $a=1; - global $b; - $c = 1; - $b = 5; - echo "$a $b "; - $a++; - $c++; - echo "$a $c "; - } - Test(); - echo "$a $b $c "; - Test(); - echo "$a $b $c "; - Test()?> +<?php +error_reporting(0); +$a = 10; + +function Test() +{ + static $a=1; + global $b; + $c = 1; + $b = 5; + echo "$a $b "; + $a++; + $c++; + echo "$a $c "; +} + +Test(); +echo "$a $b $c "; +Test(); +echo "$a $b $c "; +Test(); +?> --EXPECT-- 1 5 2 2 10 5 2 5 3 2 10 5 3 5 4 2 Index: php4/tests/lang/008.phpt diff -u php4/tests/lang/008.phpt:1.1 php4/tests/lang/008.phpt:1.2 --- php4/tests/lang/008.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/008.phpt Fri Mar 29 12:12:11 2002 @@ -3,14 +3,18 @@ --POST-- --GET-- --FILE-- -<?php Function Test() - { - static $a=1; +<?php - echo "$a "; - $a++; - if($a<10): Test(); endif; - } - Test()?> +function Test() +{ + static $a=1; + echo "$a "; + $a++; + if($a<10): Test(); endif; +} + +Test(); + +?> --EXPECT-- 1 2 3 4 5 6 7 8 9 Index: php4/tests/lang/009.phpt diff -u php4/tests/lang/009.phpt:1.1 php4/tests/lang/009.phpt:1.2 --- php4/tests/lang/009.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/009.phpt Fri Mar 29 12:12:11 2002 @@ -3,9 +3,11 @@ --POST-- --GET-- --FILE-- -<?php old_function Test $a,$b ( - echo $a+$b; - ); - Test(1,2)?> +<?php +function test ($a,$b) { + echo $a+$b; +} +test(1,2); +?> --EXPECT-- 3 Index: php4/tests/lang/010.phpt diff -u php4/tests/lang/010.phpt:1.1 php4/tests/lang/010.phpt:1.2 --- php4/tests/lang/010.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/010.phpt Fri Mar 29 12:12:11 2002 @@ -3,11 +3,13 @@ --POST-- --GET-- --FILE-- -<?php old_function Test $b ( - $b++; - return($b); - ); - $a = Test(1); - echo $a?> +<?php +function test ($b) { + $b++; + return($b); +} +$a = test(1); +echo $a; +?> --EXPECT-- 2 Index: php4/tests/lang/012.phpt diff -u php4/tests/lang/012.phpt:1.1 php4/tests/lang/012.phpt:1.2 --- php4/tests/lang/012.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/012.phpt Fri Mar 29 12:12:11 2002 @@ -4,17 +4,17 @@ --GET-- --FILE-- <?php -old_function F ( - if(1): +function F () { + if(1) { return("Hello"); - endif; -); + } +} $i=0; -while($i<2): +while ($i<2) { echo F(); $i++; -endwhile; +} ?> --EXPECT-- HelloHello Index: php4/tests/lang/013.phpt diff -u php4/tests/lang/013.phpt:1.1 php4/tests/lang/013.phpt:1.2 --- php4/tests/lang/013.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/013.phpt Fri Mar 29 12:12:11 2002 @@ -4,9 +4,9 @@ --GET-- --FILE-- <?php - error_reporting(0); - $a="echo \"Hello\";"; - eval($a); +error_reporting(0); +$a="echo \"Hello\";"; +eval($a); ?> --EXPECT-- Hello Index: php4/tests/lang/014.phpt diff -u php4/tests/lang/014.phpt:1.1 php4/tests/lang/014.phpt:1.2 --- php4/tests/lang/014.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/014.phpt Fri Mar 29 12:12:11 2002 @@ -4,9 +4,9 @@ --GET-- --FILE-- <?php -old_function F $a ( +function F ($a) { eval($a); -); +} error_reporting(0); F("echo \"Hello\";"); Index: php4/tests/lang/015.phpt diff -u php4/tests/lang/015.phpt:1.1 php4/tests/lang/015.phpt:1.2 --- php4/tests/lang/015.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/015.phpt Fri Mar 29 12:12:11 2002 @@ -3,8 +3,8 @@ --POST-- --GET-- --FILE-- -<?php - include "015.inc"; +<?php +include "015.inc"; ?> --EXPECT-- Hello Index: php4/tests/lang/016.inc diff -u php4/tests/lang/016.inc:1.1 php4/tests/lang/016.inc:1.2 --- php4/tests/lang/016.inc:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/016.inc Fri Mar 29 12:12:11 2002 @@ -1,5 +1,5 @@ <?php - old_function MyFunc $a ( - echo $a; - ); +function MyFunc ($a) { + echo $a; +} ?> Index: php4/tests/lang/016.phpt diff -u php4/tests/lang/016.phpt:1.1 php4/tests/lang/016.phpt:1.2 --- php4/tests/lang/016.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/016.phpt Fri Mar 29 12:12:11 2002 @@ -4,8 +4,8 @@ --GET-- --FILE-- <?php - include "016.inc"; - MyFunc("Hello"); +include "016.inc"; +MyFunc("Hello"); ?> --EXPECT-- Hello Index: php4/tests/lang/017.phpt diff -u php4/tests/lang/017.phpt:1.1 php4/tests/lang/017.phpt:1.2 --- php4/tests/lang/017.phpt:1.1 Sun Aug 27 15:46:05 2000 +++ php4/tests/lang/017.phpt Fri Mar 29 12:12:11 2002 @@ -3,16 +3,18 @@ --POST-- --GET-- --FILE-- -<?php $a = 1; -old_function Test $a ( - if($a<3): +<?php +$a = 1; +function Test ($a) { + if ($a<3) { return(3); - endif; -); + } +} -if($a < Test($a)): +if ($a < Test($a)) { echo "$a\n"; $a++; -endif?> +} +?> --EXPECT-- 1 Index: php4/tests/lang/022.phpt diff -u php4/tests/lang/022.phpt:1.4 php4/tests/lang/022.phpt:1.5 --- php4/tests/lang/022.phpt:1.4 Thu Apr 26 15:42:08 2001 +++ php4/tests/lang/022.phpt Fri Mar 29 12:12:11 2002 @@ -7,7 +7,7 @@ function switchtest ($i, $j) { - switch ($i): + switch ($i) { case 0: switch($j) { case 0: @@ -24,7 +24,7 @@ break; default: echo "Default taken\n"; - endswitch; + } } for ($i=0; $i<3; $i++) { for ($k=0; $k<10; $k++) { Index: php4/tests/lang/025.phpt diff -u php4/tests/lang/025.phpt:1.2 php4/tests/lang/025.phpt:1.3 --- php4/tests/lang/025.phpt:1.2 Wed Mar 21 07:47:33 2001 +++ php4/tests/lang/025.phpt Fri Mar 29 12:12:11 2002 @@ -4,24 +4,17 @@ --GET-- --FILE-- <?php -old_function RekTest $nr ( - -echo " $nr "; - - -$j=$nr+1; -while ($j < 10) -{ - echo " a "; - RekTest($j); - $j++; - echo " b $j "; -}; -echo "\n"; - - - -); +function RekTest ($nr) { + echo " $nr "; + $j=$nr+1; + while ($j < 10) { + echo " a "; + RekTest($j); + $j++; + echo " b $j "; + } + echo "\n"; +} RekTest(0); ?> Index: php4/tests/lang/029.phpt diff -u php4/tests/lang/029.phpt:1.1 php4/tests/lang/029.phpt:1.2 --- php4/tests/lang/029.phpt:1.1 Wed Dec 6 11:22:01 2000 +++ php4/tests/lang/029.phpt Fri Mar 29 12:12:11 2002 @@ -6,11 +6,7 @@ <?php class obj { function method() {} - } - -function test($o_copy) { - $o_copy->root->set_in_copied_o=TRUE; - var_dump($o_copy);?><BR><?php } +} $o->root=new obj(); Index: php4/tests/lang/030.phpt diff -u php4/tests/lang/030.phpt:1.2 php4/tests/lang/030.phpt:1.3 --- php4/tests/lang/030.phpt:1.2 Wed Dec 6 13:55:52 2000 +++ php4/tests/lang/030.phpt Fri Mar 29 12:12:11 2002 @@ -8,13 +8,17 @@ function foo($name) { $GLOBALS['List']= &$this; $this->Name = $name; - $GLOBALS['List']->echoName(); } + $GLOBALS['List']->echoName(); + } function echoName() { - $GLOBALS['names'][]=$this->Name; } } - -function &foo2(&$foo) { - return $foo; } + $GLOBALS['names'][]=$this->Name; + } +} + +function &foo2(&$foo) { + return $foo; +} $bar1 =& new foo('constructor'); @@ -28,6 +32,7 @@ $List->echoName(); -print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; ?> +print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; +?> --EXPECT-- -success \ No newline at end of file +success Index: php4/tests/lang/031.phpt diff -u php4/tests/lang/031.phpt:1.4 php4/tests/lang/031.phpt:1.5 --- php4/tests/lang/031.phpt:1.4 Fri Mar 29 03:34:02 2002 +++ php4/tests/lang/031.phpt Fri Mar 29 12:12:11 2002 @@ -5,17 +5,16 @@ --FILE-- <?php // reported by php.net@alienbill.com - $outsidearray = array("key1","key2"); - $insidearray = array("0","1"); +$outsidearray = array("key1","key2"); +$insidearray = array("0","1"); - while(list(,$outerval) = each($outsidearray)){ - $placeholder = $insidearray; - while(list(,$innerval) = each($insidearray)){ - print "inloop $innerval for $outerval\n"; - } - } +while(list(,$outerval) = each($outsidearray)){ + $placeholder = $insidearray; + while(list(,$innerval) = each($insidearray)){ + print "inloop $innerval for $outerval\n"; + } +} ?> --EXPECT-- inloop 0 for key1 inloop 1 for key1 - Index: php4/tests/lang/033.phpt +++ php4/tests/lang/033.phpt --TEST-- Alternative syntaxes test --POST-- --GET-- --FILE-- <?php $a = 1; echo "If: "; if ($a) echo 1; else echo 0; if ($a): echo 1; else: echo 0; endif; echo "\nWhile: "; while ($a<5) echo $a++; while ($a<9): echo ++$a; endwhile; echo "\nFor: "; for($a=0;$a<5;$a++) echo $a; for($a=0;$a<5;$a++): echo $a; endfor; echo "\nSwitch: "; switch ($a): case 0; echo 0; break; case 5: echo 1; break; default; echo 0; break; endswitch; echo "\nold_function: "; old_function foo $bar, $baz ( return sprintf("foo(%s, %s);\n", $bar, $baz); ); echo foo(1,2); ?> --EXPECT-- If: 11 While: 12346789 For: 0123401234 Switch: 1 old_function: foo(1, 2);
« previous php.cvs (#10771) next »