File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / sapi / cli / tests / 007.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:35 2012 UTC (12 years, 2 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

    1: --TEST--
    2: strip comments and whitespace with -w
    3: --SKIPIF--
    4: <?php 
    5: include "skipif.inc"; 
    6: if (substr(PHP_OS, 0, 3) == 'WIN') {
    7: 	die ("skip not for Windows");
    8: }
    9: ?>
   10: --FILE--
   11: <?php
   12: 
   13: $php = getenv('TEST_PHP_EXECUTABLE');
   14: 
   15: $filename = dirname(__FILE__).'/007.test.php';
   16: $code ='
   17: <?php
   18: /* some test script */
   19: 
   20: class test { /* {{{ */
   21: 	public $var = "test"; //test var
   22: #perl style comment 
   23: 	private $pri; /* private attr */
   24: 
   25: 	function foo(/* void */) {
   26: 	}
   27: }
   28: /* }}} */
   29: 
   30: ?>
   31: ';
   32: 
   33: file_put_contents($filename, $code);
   34: 
   35: var_dump(`$php -n -w "$filename"`);
   36: var_dump(`$php -n -w "wrong"`);
   37: var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo() {} } ?>" | $php -n -w`);
   38: 
   39: @unlink($filename);
   40: 
   41: echo "Done\n";
   42: ?>
   43: --EXPECTF--	
   44: string(81) "
   45: <?php
   46:  class test { public $var = "test"; private $pri; function foo() { } } ?>
   47: "
   48: string(33) "Could not open input file: wrong
   49: "
   50: string(43) "<?php  class test { function foo() {} } ?>
   51: "
   52: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>