003.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. strip comments and whitespace with -w
  3. --SKIPIF--
  4. <?php
  5. include "skipif.inc";
  6. ?>
  7. --FILE--
  8. <?php
  9. include "include.inc";
  10. $php = get_cgi_path();
  11. reset_env_vars();
  12. $filename = dirname(__FILE__).'/003.test.php';
  13. $code ='
  14. <?php
  15. /* some test script */
  16. class test { /* {{{ */
  17. public $var = "test"; //test var
  18. #perl style comment
  19. private $pri; /* private attr */
  20. function foo(/* void */) {
  21. }
  22. }
  23. /* }}} */
  24. ?>
  25. ';
  26. file_put_contents($filename, $code);
  27. var_dump(`$php -n -w "$filename"`);
  28. var_dump(`$php -n -w "wrong"`);
  29. var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo() {} } ?>" | $php -n -w`);
  30. @unlink($filename);
  31. echo "Done\n";
  32. ?>
  33. --EXPECTF--
  34. string(%d) "X-Powered-By: PHP/%s
  35. Content-type: text/html%r; charset=.*|%r
  36. <?php
  37. class test { public $var = "test"; private $pri; function foo() { } } ?>
  38. "
  39. string(%d) "Status: 404 Not Found
  40. X-Powered-By: PHP/%s
  41. Content-type: text/html%r; charset=.*|%r
  42. No input file specified.
  43. "
  44. string(%d) "X-Powered-By: PHP/%s
  45. Content-type: text/html%r; charset=.*|%r
  46. <?php class test { function foo() {} } ?>
  47. "
  48. Done