]> granicus.if.org Git - php/commitdiff
update and correct
authorMarcus Boerger <helly@php.net>
Wed, 23 Oct 2002 12:59:18 +0000 (12:59 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 23 Oct 2002 12:59:18 +0000 (12:59 +0000)
README.TESTING

index aab8f9e7f4269fae0a7741a3048ec89a1f78cabb..2c2635e2e2b1f88403e626e1fb7314c00ac20f0e 100644 (file)
@@ -81,7 +81,7 @@ ext/myext/tests/myext.diff  - diff of .out and .exp (D)
 NOTE: The files generated by tests can be selected by setting the
 environment variable TEST_PHP_LOG_FORMAT. For each file you want to be
 generated use the character in brackets as shown above (default is LEOD).
-The php file will be generated allways.
+The php file will be generated always.
 
 NOTE: You can set environment variable TEST_PHP_DETAILED to enable
 detailed test information.
@@ -106,13 +106,15 @@ abcd
 
  As you can see the file has the following sections:
 
-"--TEST--" is title of the test.
-"--SKIPIF--" is condition when to skip this test (optional).
-"--POST--" is POST variable passed to test script (optional).
-"--GET--" is GET variable passed to test script (optional).
-"--INI--" each line contains an ini setting e.g. foo=bar (optional).
-"--FILE--" is the test script.
-"--EXPECT--" is the expected output from the test script.
+"--TEST--"    is title of the test.
+"--SKIPIF--"  is condition when to skip this test (optional).
+"--POST--"    is POST variable passed to test script (optional).
+"--GET--"     is GET variable passed to test script (optional).
+"--INI--"     each line contains an ini setting e.g. foo=bar (optional).
+"--FILE--"    is the test script.
+"--EXPECT--"  is the expected output from the test script.
+"--EXPECTF--" this is the alternate form of --EXPECT--. The difference 
+              is is that this form uses sscanf for output validation.
 
 ext/iconv/002.phpt uses 2 files. "skipif.inc" is used to skip
 test when test cannot be performed such as iconv module is not
@@ -152,11 +154,33 @@ abcd
 ?>
 === end of ext/iconv/002.inc ===
 
-Test script and skipif code may be directly written into *.phpt.
-However, it is recommended to use other files for ease of writing
-test scripts. 
+Test script and SKIPIF code should be directly written into *.phpt.
+However, it is recommended to use include files when more test scripts
+depend on the same SKIPIF code or when certain test files need the same
+values for some input.
 
 
+/ext/standard/tests/strings 003.phpt is a good example for using EXPECTF 
+instead of EXPECT. From time to time the algorythmn used for shuffle 
+changed and sometimes the machine used to execute the code has influence 
+on the result of shuffle. But it always retuns a three character string 
+detectable by %s. Other forms scanable are %i for integers, %f for 
+floating point values and %x for hexadecimal values.
+
+==== /ext/standard/tests/strings 003.phpt ===
+--TEST--
+Testing str_shuffle.
+--FILE--
+<?php
+$s = '123';
+var_dump(str_shuffle($s));
+var_dump($s);
+?>
+--EXPECTF--
+string(3) %s
+string(3) "123"
+==== end of /ext/standard/tests/strings 003.phpt ===
+
 [How to help us]
 ----------------
  If you find bug in PHP, you can submit bug report AND test script