From: Max Semenik Date: Wed, 23 Feb 2011 08:06:11 +0000 (+0000) Subject: Very basic JavaScriiptDistiller tests, needs serious expansion X-Git-Tag: 1.31.0-rc.0~31820 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=5875959e25267f034c3c29816da4c751a3927ee8;p=lhc%2Fweb%2Fwiklou.git Very basic JavaScriiptDistiller tests, needs serious expansion --- diff --git a/tests/phpunit/includes/libs/JavaScriptDistillerTest.php b/tests/phpunit/includes/libs/JavaScriptDistillerTest.php new file mode 100644 index 0000000000..ddacd1e4df --- /dev/null +++ b/tests/phpunit/includes/libs/JavaScriptDistillerTest.php @@ -0,0 +1,18 @@ +assertEquals( $out, JavaScriptDistiller::stripWhiteSpace( $in ) ); + $this->assertEquals( $outFull, JavaScriptDistiller::stripWhiteSpace( $in, true ) ); + } + + private static function read( $file ) { + $text = file_get_contents( dirname( __FILE__ ) . "/$file" ); + return str_replace( "\r\n", "\n", $text ); + } +} \ No newline at end of file diff --git a/tests/phpunit/includes/libs/distiller-in.js b/tests/phpunit/includes/libs/distiller-in.js new file mode 100644 index 0000000000..66116957e7 --- /dev/null +++ b/tests/phpunit/includes/libs/distiller-in.js @@ -0,0 +1,15 @@ +/* this is a comment */ +/* a multi- + line comment */ +/* a /* weird comment */ +// one-line comment +var string = /* comment */'/* comment in string */'; + +move_to_the_same_line() + + dont_move(); + +if ( / a + bfoo.* /i.test( bar ) && ( a / b ) * c + d - e) { /* blah */ + statement(); + statement() +} \ No newline at end of file diff --git a/tests/phpunit/includes/libs/distiller-out-full.js b/tests/phpunit/includes/libs/distiller-out-full.js new file mode 100644 index 0000000000..ae0b35671d --- /dev/null +++ b/tests/phpunit/includes/libs/distiller-out-full.js @@ -0,0 +1,7 @@ + + + + +var string='/* comment in string */';move_to_the_same_line() +dont_move();if(/ a + bfoo.* /i.test(bar)&&(a/ b ) * c + d - e){ +statement();statement()} \ No newline at end of file diff --git a/tests/phpunit/includes/libs/distiller-out.js b/tests/phpunit/includes/libs/distiller-out.js new file mode 100644 index 0000000000..1886143428 --- /dev/null +++ b/tests/phpunit/includes/libs/distiller-out.js @@ -0,0 +1,11 @@ + + + + +var string='/* comment in string */'; +move_to_the_same_line() +dont_move(); +if(/ a + bfoo.* /i.test(bar)&&(a/ b ) * c + d - e) { /*blah*/ +statement(); +statement() +} \ No newline at end of file