From 70daee86e69783928d3da887a3a3e26b8ab74734 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Tue, 14 Oct 2014 16:12:08 +0200 Subject: Corrected compression for ++ and -- operator. Partially fixes #897. --- _test/tests/lib/exe/js_js_compress.test.php | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to '_test') diff --git a/_test/tests/lib/exe/js_js_compress.test.php b/_test/tests/lib/exe/js_js_compress.test.php index b1ae2a84f..78e089d89 100644 --- a/_test/tests/lib/exe/js_js_compress.test.php +++ b/_test/tests/lib/exe/js_js_compress.test.php @@ -145,6 +145,66 @@ EOF; $this->assertEquals($out, js_compress($text)); } + function test_plusplus1(){ + $text = 'a = 5 + ++b;'; + $this->assertEquals('a=5+ ++b;',js_compress($text)); + } + + function test_plusplus2(){ + $text = 'a = 5+ ++b;'; + $this->assertEquals('a=5+ ++b;',js_compress($text)); + } + + function test_plusplus3(){ + $text = 'a = 5++ + b;'; + $this->assertEquals('a=5++ +b;',js_compress($text)); + } + + function test_plusplus4(){ + $text = 'a = 5++ +b;'; + $this->assertEquals('a=5++ +b;',js_compress($text)); + } + + function test_minusminus1(){ + $text = 'a = 5 - --b;'; + $this->assertEquals('a=5- --b;',js_compress($text)); + } + + function test_minusminus2(){ + $text = 'a = 5- --b;'; + $this->assertEquals('a=5- --b;',js_compress($text)); + } + + function test_minusminus3(){ + $text = 'a = 5-- - b;'; + $this->assertEquals('a=5-- -b;',js_compress($text)); + } + + function test_minusminus4(){ + $text = 'a = 5-- -b;'; + $this->assertEquals('a=5-- -b;',js_compress($text)); + } + + function test_minusplus1(){ + $text = 'a = 5-- +b;'; + $this->assertEquals('a=5--+b;',js_compress($text)); + } + + function test_minusplus2(){ + $text = 'a = 5-- + b;'; + $this->assertEquals('a=5--+b;',js_compress($text)); + } + + function test_plusminus1(){ + $text = 'a = 5++ - b;'; + $this->assertEquals('a=5++-b;',js_compress($text)); + } + + function test_plusminus2(){ + $text = 'a = 5++ -b;'; + $this->assertEquals('a=5++-b;',js_compress($text)); + } + /** * Test the files provided with the original JsStrip */ -- cgit v1.2.3