[PHP-CVS] cvs: php-src(PHP_5_3) /scripts/dev generate_phpt.php

2008-04-15 Thread Zoe Slattery
zoe Tue Apr 15 19:50:13 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/scripts/devgenerate_phpt.php 
  Log:
  Changes to the code that generates variations (Robin & Josie)
  
http://cvs.php.net/viewvc.cgi/php-src/scripts/dev/generate_phpt.php?r1=1.1.2.4&r2=1.1.2.5&diff_format=u
Index: php-src/scripts/dev/generate_phpt.php
diff -u php-src/scripts/dev/generate_phpt.php:1.1.2.4 
php-src/scripts/dev/generate_phpt.php:1.1.2.5
--- php-src/scripts/dev/generate_phpt.php:1.1.2.4   Sun Apr 13 10:46:12 2008
+++ php-src/scripts/dev/generate_phpt.php   Tue Apr 15 19:50:13 2008
@@ -323,70 +323,72 @@
 
// integer values
$variation_array['int'] = array(
-   "0",
-   "1",
-   "12345",
-   "-2345"
+   "'int 0' => 0",
+   "'int 1' => 1",
+   "'int 12345' => 12345",
+   "'int -12345' => -2345"
);
 
// float values
$variation_array['float'] = array(
-   "10.5",
-   "-10.5",
-   "10.1234567e10",
-   "10.7654321E-10",
-   ".5"
+   "'float 10.5' => 10.5",
+   "'float -10.5' => -10.5",
+   "'float 12.3456789000e10' => 12.3456789000e10",
+   "'float -12.3456789000e10' => -12.3456789000e10",
+   "'float .5' => .5"
);
 
// array values
$variation_array['array'] = array(
-   "array()",
-   "array(0)",
-   "array(1)",
-   "array(1, 2)",
-   "array('color' => 'red', 'item' => 'pen')"
+   "'empty array' => array()",
+   "'int indexed array' => \$index_array",
+   "'associative array' => \$assoc_array",
+   "'nested arrays' => array('foo', \$index_array, \$assoc_array)",
);
 
// null vlaues
$variation_array['null'] = array(
-   "NULL",
-   "null"
+   "'uppercase NULL' => NULL",
+   "'lowercase null' => null"
);
 
// boolean values
$variation_array['boolean'] = array(
-   "true",
-   "false",
-   "TRUE",
-   "FALSE"
+   "'lowercase true' => true",
+   "'lowercase false' =>false",
+   "'uppercase TRUE' =>TRUE",
+   "'uppercase FALSE' =>FALSE"
);
 
-   // empty string
+   // empty data
$variation_array['empty'] = array(
-   "\"\"",
-   "''",
+   "'empty string DQ' => \"\"",
+   "'empty string SQ' => ''"
);
 
// string values
$variation_array['string'] = array(
-   "\"string\"",
-   "'string'",
+   "'string DQ' => \"string\"",
+   "'string SQ' => 'string'",
+   "'mixed case string' => \"sTrInG\"",
+   "'heredoc' => \$heredoc"
);
 
-   // objects
+   // object data
$variation_array['object'] = array(
-   "new stdclass()"
+   "'instance of classWithToString' => new classWithToString()",
+   "'instance of classWithoutToString' => new 
classWithoutToString()"
);
 
 
// undefined variable
$variation_array['undefined'] = array(
-   '$undefined_var'
+   "'undefined var' => @\$undefined_var"   
);
 
// unset variable
$variation_array['unset'] = array(
-   '$unset_var'
+   "'unset var' => @\$unset_var"
);
 
 
@@ -611,6 +613,9 @@
 
// decrement the $which_arg so that its matches with  the index of 
$types
$which_arg--;
+   
+   //generate code to define error handler
+   $code_block = add_error_handler($code_block);
 
// generate code to initialise arguments that won't be substituted
array_push($code_block, "// Initialise function arguments not being 
substituted (if any)");
@@ -621,16 +626,34 @@
}
}
array_push($code_block, $blank_line);
+   
 
// generate code to unset a variable
array_push($code_block, "//get an unset variable");
array_push($code_block, "\$unset_var = 10;");
array_push($code_block, "unset (\$unset_var);");
array_push($code_block, $blank_line);
+   
+   //define some classes
+   $code_block = define_classes($code_block);
+   
+   //add heredoc string
+   array_push($code_block, "// heredoc string");
+   array_push($code_block, "\$heredoc = << 1, 'two' => 
2);");
+   array_push($code_block, $blank_line);
+   
 
//generate code for an array of values to iterate over
array_push($code_block, "//array of values to iterate over");
-   $code_bl

[PHP-CVS] cvs: php-src(PHP_5_3) /scripts/dev generate_phpt.php

2008-04-13 Thread Zoe Slattery
zoe Sun Apr 13 10:46:12 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/scripts/devgenerate_phpt.php 
  Log:
  Fixing: 
  (1) remove proto from start
  (2)substitute "Done" with ===DONE== after closing tag in FILE section and at 
end of EXPECTF.
  (3) Remove "add comment here..."
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/scripts/dev/generate_phpt.php?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: php-src/scripts/dev/generate_phpt.php
diff -u php-src/scripts/dev/generate_phpt.php:1.1.2.3 
php-src/scripts/dev/generate_phpt.php:1.1.2.4
--- php-src/scripts/dev/generate_phpt.php:1.1.2.3   Thu Feb 14 10:15:44 2008
+++ php-src/scripts/dev/generate_phpt.php   Sun Apr 13 10:46:12 2008
@@ -49,7 +49,7 @@
exit();
 }
 
-$test_info['proto'] = "proto ".$test_info['return_type']." ". 
$test_info['name']."(".$test_info['params'].")";
+$test_info['proto'] = $test_info['return_type']." ". 
$test_info['name']."(".$test_info['params'].")";
 
 
 //Set the test sections array - may want more in this later?
@@ -448,7 +448,7 @@
$test_case = array();
 
$test_case = gen_test_header($name, $proto, $desc, 
- $source_file, "usage variations", " - 
", $alias, $test_case);
+ $source_file, "usage variation","", 
$alias, $test_case);
 
// add variation code
$test_case['--FILE--'] = 
gen_variation_diff_arg_values_test($name, $arg_det, $arg_count, 
$test_case['--FILE--']);
@@ -495,10 +495,6 @@
" * Alias to functions: $alias",
" */",
"",
-   "/*",
-   " * add a comment here to say what the 
test is supposed to do",
-   " */",
-   "",
"echo \"*** Testing $fn_name() : 
$type_msg ***\\n\";",
""
);
@@ -558,12 +554,12 @@
 function gen_test_trailer($test_case, $section_key = "--EXPECTF--") {
//Complete the --FILE-- section
array_push($test_case['--FILE--'], "");
-   array_push($test_case['--FILE--'], "echo \"Done\";", "?>");
+   array_push($test_case['--FILE--'], "?>\n===DONE===");
 
//add a new key for the expect section
$test_case[$section_key]=array();
array_push($test_case[$section_key], "Expected output goes here"); 
-   array_push($test_case[$section_key], "Done"); 
+   array_push($test_case[$section_key], "===DONE==="); 
 
return $test_case;
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /scripts/dev generate_phpt.php

2008-02-14 Thread Zoe Slattery
zoe Thu Feb 14 10:15:44 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/scripts/devgenerate_phpt.php 
  Log:
  Fixing typo arg->arglist at line 195. Thanks Chris J!
  
http://cvs.php.net/viewvc.cgi/php-src/scripts/dev/generate_phpt.php?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/scripts/dev/generate_phpt.php
diff -u php-src/scripts/dev/generate_phpt.php:1.1.2.2 
php-src/scripts/dev/generate_phpt.php:1.1.2.3
--- php-src/scripts/dev/generate_phpt.php:1.1.2.2   Wed Feb  6 10:56:22 2008
+++ php-src/scripts/dev/generate_phpt.php   Thu Feb 14 10:15:44 2008
@@ -912,7 +912,7 @@
break;
 
 default:
-echo "Command line option $arg[$j] not 
recognised\n";
+echo "Command line option $arglist[$j] not 
recognised\n";
 print_opts();
 }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /scripts/dev generate_phpt.php

2008-02-06 Thread Zoe Slattery
zoe Wed Feb  6 10:56:22 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/scripts/devgenerate_phpt.php 
  Log:
  Fixing bug 44042
  http://cvs.php.net/viewvc.cgi/php-src/scripts/dev/generate_phpt.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/scripts/dev/generate_phpt.php
diff -u php-src/scripts/dev/generate_phpt.php:1.1.2.1 
php-src/scripts/dev/generate_phpt.php:1.1.2.2
--- php-src/scripts/dev/generate_phpt.php:1.1.2.1   Sun Feb  3 09:34:59 2008
+++ php-src/scripts/dev/generate_phpt.php   Wed Feb  6 10:56:22 2008
@@ -33,13 +33,16 @@
 $test_info = get_loc_proto($all_c, $opt['name'], $opt['source_loc']);
 
 if (!$test_info['found']) {
-   echo "Exiting: Unable to find implementation of {$opt['name']} in 
{$opt['source_loc']}\n";
+   echo "\nExiting: Unable to find implementation of {$opt['name']} in 
{$opt['source_loc']}\n";
+   if ($test_info['falias']) {
+   //But it may be aliased to something else
+   echo "\n{$test_info['name']}() is an alias of 
{$test_info['alias']}() --- Write test cases for this instead \n";
+   }
exit();
 }
 if ($test_info['falias']) {
-   //If this function is  falias'd to another function direct the test 
case writer to the principle alias for tests
-   echo "{$test_info['name']}() is an alias of {$test_info['alias']}() --- 
please see testcases for {$test_info['alias']}() \n";
-   exit();
+   //If this function is  falias'd to another function tell the test case 
writer about them
+   echo "\nNote: {$test_info['name']}() is an alias of 
{$test_info['alias']}() \n";
 }
 if ($test_info['error'] != NULL) {
echo $test_info['error']."\n";
@@ -330,8 +333,8 @@
$variation_array['float'] = array(
"10.5",
"-10.5",
-   "10.5e10",
-   "10.6E-10",
+   "10.1234567e10",
+   "10.7654321E-10",
".5"
);
 
@@ -801,86 +804,6 @@
 array_push ($code_block, "var_dump( $fn_name(\$$arg_name) );");
   return $code_block;
 }
-/* 
- * Function to get the name of the source file in which the function is 
implemented and the proto comment
- * Arguments: 
- * $all_c => list of all c files in the PHP source
- * $fname => function name
- * $source => directory path of PHP source code
- * Returns:
- * $test_info = > array( source file, return type, parameters, falias, 
found, alias, error)
- */
-function get_loc_proto($all_c, $fname, $source) {
-//get location 
-$test_info['name'] = $fname;
-$test_info['source_file'] = NULL;
-$test_info['return_type'] = NULL;
-$test_info['params'] = NULL;
-$test_info['falias'] = false;
-$test_info['found'] = false;
-$test_info['alias'] = NULL;
-$test_info['error'] = NULL;
-  
-$escaped_source = preg_replace("/\\\/", "\\", $source);
-$escaped_source = preg_replace("/\//", "\\\/", $escaped_source);
-
-
-   for ($i=0; $i

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php