From 73d6aaf0f8f66d23a00863676bf0ac07438701cb Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann <deckelmann@gmail.com> Date: Sat, 7 Apr 2012 00:01:39 +0200 Subject: [PATCH] transformed lib/ unittests to phpunit --- _testing/unittests/bootstrap.php | 3 +- .../lib/exe/css_css_compress.test.php | 68 ++++++++++ .../lib/exe/css_css_loadfile.test.php | 55 ++++++++ .../unittests/lib/exe/js_js_compress.test.php | 128 ++++++++++++++++++ .../test-CommentInDoubleQuotes1-in.js | 5 + .../test-CommentInDoubleQuotes1-out.js | 1 + .../test-CommentInDoubleQuotes2-in.js | 5 + .../test-CommentInDoubleQuotes2-out.js | 1 + .../test-CommentInSingleQuotes1-in.js | 5 + .../test-CommentInSingleQuotes1-out.js | 1 + .../test-CommentInSingleQuotes2-in.js | 5 + .../test-CommentInSingleQuotes2-out.js | 1 + .../test-CommentMultiline-in.js | 11 ++ .../test-CommentMultiline-out.js | 1 + .../test-CommentSingleLine-in.js | 7 + .../test-CommentSingleLine-out.js | 1 + .../test-IfThenElseBraces-in.js | 7 + .../test-IfThenElseBraces-out.js | 1 + .../test-IfThenElseNoBraces-in.js | 7 + .../test-IfThenElseNoBraces-out.js | 1 + .../js_js_compress/test-RegexpBackslash-in.js | 3 + .../test-RegexpBackslash-out.js | 1 + .../js_js_compress/test-RegexpSimple-in.js | 3 + .../js_js_compress/test-RegexpSimple-out.js | 1 + .../test-RegexpSimpleWhitespace-in.js | 5 + .../test-RegexpSimpleWhitespace-out.js | 1 + .../js_js_compress/test-RegexpString-in.js | 3 + .../js_js_compress/test-RegexpString-out.js | 1 + .../test-StatementDoWhile-in.js | 2 + .../test-StatementDoWhile-out.js | 1 + .../js_js_compress/test-StatementForIn-in.js | 2 + .../js_js_compress/test-StatementForIn-out.js | 1 + .../js_js_compress/test-StatementNew-in.js | 1 + .../js_js_compress/test-StatementNew-out.js | 1 + .../test-StatementSwitchCase-in.js | 4 + .../test-StatementSwitchCase-out.js | 1 + .../test-StringDoubleQuotes-in.js | 3 + .../test-StringDoubleQuotes-out.js | 1 + .../test-StringSingleQuotes-in.js | 8 ++ .../test-StringSingleQuotes-out.js | 1 + 40 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 _testing/unittests/lib/exe/css_css_compress.test.php create mode 100644 _testing/unittests/lib/exe/css_css_loadfile.test.php create mode 100644 _testing/unittests/lib/exe/js_js_compress.test.php create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpString-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-RegexpString-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementForIn-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementForIn-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementNew-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementNew-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-out.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-in.js create mode 100644 _testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-out.js diff --git a/_testing/unittests/bootstrap.php b/_testing/unittests/bootstrap.php index 27ca1635e..6a06a2dff 100644 --- a/_testing/unittests/bootstrap.php +++ b/_testing/unittests/bootstrap.php @@ -1,6 +1,7 @@ <?php -define('DOKU_UNITTEST',true); +define('DOKU_UNITTEST', true); +define('SIMPLE_TEST', true); if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); define('DOKU_CONF',realpath(dirname(__FILE__).'/../../conf').'/'); diff --git a/_testing/unittests/lib/exe/css_css_compress.test.php b/_testing/unittests/lib/exe/css_css_compress.test.php new file mode 100644 index 000000000..3fbb5820d --- /dev/null +++ b/_testing/unittests/lib/exe/css_css_compress.test.php @@ -0,0 +1,68 @@ +<?php + +require_once DOKU_INC.'lib/exe/css.php'; + + +class css_css_compress_test extends PHPUnit_Framework_TestCase { + + function test_mlcom1(){ + $text = '/** + * A multi + * line *test* + * check + */'; + $this->assertEquals(css_compress($text), ''); + } + + function test_mlcom2(){ + $text = '#comment/* */ { + color: lime; + }'; + $this->assertEquals(css_compress($text), '#comment/* */{color:lime;}'); + } + + function test_slcom1(){ + $text = '// this is a comment'; + $this->assertEquals(css_compress($text), ''); + } + + function test_slcom2(){ + $text = '#foo { + color: lime; // another comment + }'; + $this->assertEquals(css_compress($text), '#foo{color:lime;}'); + } + + function test_slcom3(){ + $text = '#foo { + background-image: url(http://foo.bar/baz.jpg); + }'; + $this->assertEquals(css_compress($text), '#foo{background-image:url(http://foo.bar/baz.jpg);}'); + } + + function test_hack(){ + $text = '/* Mac IE will not see this and continue with inline-block */ + /* \\*/ + display: inline; + /* */'; + $this->assertEquals(css_compress($text), '/* \\*/display:inline;/* */'); + } + + function test_hack2(){ + $text = '/* min-height hack for Internet Explorer http://www.cssplay.co.uk/boxes/minheight.html */ + /*\\*/ + * html .page { + height: 450px; + } + /**/'; + $this->assertEquals(css_compress($text), '/*\\*/* html .page{height:450px;}/**/'); + } + + function test_nl1(){ + $text = "a{left:20px;\ntop:20px}"; + $this->assertEquals(css_compress($text), 'a{left:20px;top:20px}'); + } + +} + +//Setup VIM: ex: et ts=4 : diff --git a/_testing/unittests/lib/exe/css_css_loadfile.test.php b/_testing/unittests/lib/exe/css_css_loadfile.test.php new file mode 100644 index 000000000..c1706c4a4 --- /dev/null +++ b/_testing/unittests/lib/exe/css_css_loadfile.test.php @@ -0,0 +1,55 @@ +<?php + +require_once DOKU_INC.'lib/exe/css.php'; + +class css_css_loadfile_test extends PHPUnit_Framework_TestCase { + public function setUp() { + $this->file = tempnam('/tmp', 'css'); + } + + private function csstest($input, $output = null, $location = 'http://www.example.com/') { + io_saveFile($this->file, $input); + $this->assertEquals(css_loadfile($this->file, $location), (is_null($output) ? $input : $output)); + } + + public function test_url_relative() { + $this->csstest('#test { background: url("test/test.png"); }', '#test { background: url("http://www.example.com/test/test.png"); }'); + $this->csstest('#test { background: url(\'test/test.png\'); }', '#test { background: url(\'http://www.example.com/test/test.png\'); }'); + } + + public function test_url_absolute() { + $this->csstest('#test { background: url("/test/test.png"); }'); + $this->csstest('#test { background: url(\'/test/test.png\'); }'); + } + + public function test_url_with_protocol() { + $this->csstest('#test { background: url("http://www.test.com/test/test.png"); }'); + $this->csstest('#test { background: url("https://www.test.com/test/test.png"); }'); + $this->csstest('#test { background: url(\'http://www.test.com/test/test.png\'); }'); + $this->csstest('#test { background: url(\'https://www.test.com/test/test.png\'); }'); + } + + public function test_import_relative() { + $this->csstest('@import "test/test.png";', '@import "http://www.example.com/test/test.png";'); + $this->csstest('@import \'test/test.png\';', '@import \'http://www.example.com/test/test.png\';'); + } + + public function test_import_absolute() { + $this->csstest('@import "/test/test.png";'); + $this->csstest('@import \'/test/test.png\';'); + } + + public function test_import_with_protocol() { + $this->csstest('@import "http://www.test.com/test/test.png";'); + $this->csstest('@import "https://www.test.com/test/test.png";'); + $this->csstest('@import \'http://www.test.com/test/test.png\';'); + $this->csstest('@import \'https://www.test.com/test/test.png\';'); + } + + public function tearDown() { + unlink($this->file); + unset($this->file); + } +} + +//Setup VIM: ex: et ts=4 sw=4 : diff --git a/_testing/unittests/lib/exe/js_js_compress.test.php b/_testing/unittests/lib/exe/js_js_compress.test.php new file mode 100644 index 000000000..c6b0a2d2c --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress.test.php @@ -0,0 +1,128 @@ +<?php + +require_once DOKU_INC.'lib/exe/js.php'; + + +class js_js_compress_test extends PHPUnit_Framework_TestCase { + + function test_mlcom1(){ + $text = '/** + * A multi + * line *test* + * check + */'; + $this->assertEquals(js_compress($text), ''); + } + + function test_mlcom2(){ + $text = 'var foo=6;/* another comment */'; + $this->assertEquals(js_compress($text), 'var foo=6;'); + } + + function test_mlcomcond(){ + $text = '/*@if (@_win32)'; + $this->assertEquals(js_compress($text), '/*@if(@_win32)'); + } + + function test_slcom1(){ + $text = '// an comment'; + $this->assertEquals(js_compress($text), ''); + } + + function test_slcom2(){ + $text = 'var foo=6;// another comment '; + $this->assertEquals(js_compress($text), 'var foo=6;'); + } + + function test_slcom3(){ + $text = 'var foo=6;// another comment / or something with // comments '; + $this->assertEquals(js_compress($text), 'var foo=6;'); + } + + function test_regex1(){ + $text = 'foo.split( /[a-Z\/]*/ );'; + $this->assertEquals(js_compress($text), 'foo.split(/[a-Z\/]*/);'); + } + + function test_regex_in_array(){ + $text = '[/"/ , /"/ , /"/]'; + $this->assertEquals(js_compress($text), '[/"/,/"/,/"/]'); + } + + function test_regex_in_hash(){ + $text = '{ a : /"/ }'; + $this->assertEquals(js_compress($text), '{a:/"/}'); + } + + function test_regex_preceded_by_spaces_caracters(){ + $text = "text.replace( \t \r\n /\"/ , ".'"//" )'; + $this->assertEquals(js_compress($text), 'text.replace(/"/,"//")'); + } + + function test_dquot1(){ + $text = 'var foo="Now what \\" \'do we//get /*here*/ ?";'; + $this->assertEquals(js_compress($text), $text); + } + + function test_dquot2(){ + $text = 'var foo="Now what \\\\\\" \'do we//get /*here*/ ?";'; + $this->assertEquals(js_compress($text), $text); + } + + function test_dquotrunaway(){ + $text = 'var foo="Now where does it end'; + $this->assertEquals(js_compress($text), $text); + } + + function test_squot1(){ + $text = "var foo='Now what \\' \"do we//get /*here*/ ?';"; + $this->assertEquals(js_compress($text), $text); + } + + function test_squotrunaway(){ + $text = "var foo='Now where does it end"; + $this->assertEquals(js_compress($text), $text); + } + + function test_nl1(){ + $text = "var foo=6;\nvar baz=7;"; + $this->assertEquals(js_compress($text), 'var foo=6;var baz=7;'); + } + + function test_lws1(){ + $text = " \t var foo=6;"; + $this->assertEquals(js_compress($text), 'var foo=6;'); + } + + function test_tws1(){ + $text = "var foo=6; \t "; + $this->assertEquals(js_compress($text), 'var foo=6;'); + } + + function test_shortcond(){ + $text = "var foo = (baz) ? 'bar' : 'bla';"; + $this->assertEquals(js_compress($text), "var foo=(baz)?'bar':'bla';"); + + } + + function test_complexminified(){ + $text = 'if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class=\'test e\'></div><div class=\'test\'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;foo="text/*";bla="*/"'; + + $this->assertEquals(js_compress($text),$text); + } + + /** + * Test the files provided with the original JsStrip + */ + function test_original(){ + $files = glob(dirname(__FILE__).'/js_js_compress/test-*-in.js'); + + foreach($files as $file){ + $info = "Using file $file"; + $this->assertEquals(js_compress(file_get_contents($file)), + file_get_contents(substr($file,0,-5).'out.js'), $info); + }; + } +} + +//Setup VIM: ex: et ts=4 : diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-in.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-in.js new file mode 100644 index 000000000..771dc1640 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-in.js @@ -0,0 +1,5 @@ + + var s = " /* this is a comment */ " ; + + + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-out.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-out.js new file mode 100644 index 000000000..7d6a5346e --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes1-out.js @@ -0,0 +1 @@ +var s=" /* this is a comment */ "; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-in.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-in.js new file mode 100644 index 000000000..a59f1b774 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-in.js @@ -0,0 +1,5 @@ + + +var s = "// this is a comment "; + + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-out.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-out.js new file mode 100644 index 000000000..caa2fdca2 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInDoubleQuotes2-out.js @@ -0,0 +1 @@ +var s="// this is a comment "; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-in.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-in.js new file mode 100644 index 000000000..845c59bdf --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-in.js @@ -0,0 +1,5 @@ + + var s = ' /* this is a comment */ ' ; + + + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-out.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-out.js new file mode 100644 index 000000000..b2696cb98 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes1-out.js @@ -0,0 +1 @@ +var s=' /* this is a comment */ '; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-in.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-in.js new file mode 100644 index 000000000..0459a4891 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-in.js @@ -0,0 +1,5 @@ + + +var s = '// this is a comment '; + + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-out.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-out.js new file mode 100644 index 000000000..21b6a410e --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentInSingleQuotes2-out.js @@ -0,0 +1 @@ +var s='// this is a comment '; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-in.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-in.js new file mode 100644 index 000000000..b9d16a7bd --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-in.js @@ -0,0 +1,11 @@ + + if (true) { + /* this + * is a + * multiline comment */ + document.write("true"); /* this + is another + */ + +} + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-out.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-out.js new file mode 100644 index 000000000..8eed2e57a --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentMultiline-out.js @@ -0,0 +1 @@ +if(true){document.write("true");} \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-in.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-in.js new file mode 100644 index 000000000..302d7160b --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-in.js @@ -0,0 +1,7 @@ + + if (true) { + // this is a single line comment + document.write("true") ; // another +} + + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-out.js b/_testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-out.js new file mode 100644 index 000000000..8eed2e57a --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-CommentSingleLine-out.js @@ -0,0 +1 @@ +if(true){document.write("true");} \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-in.js b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-in.js new file mode 100644 index 000000000..afc824762 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-in.js @@ -0,0 +1,7 @@ + + +if ( true ) { + document.write("foo"); +} else { + document.write("bar"); +} diff --git a/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-out.js b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-out.js new file mode 100644 index 000000000..2a982a98e --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseBraces-out.js @@ -0,0 +1 @@ +if(true){document.write("foo");}else{document.write("bar");} \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-in.js b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-in.js new file mode 100644 index 000000000..79d10775e --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-in.js @@ -0,0 +1,7 @@ + + +if ( true ) + document.write("foo"); + else + document.write("bar"); + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-out.js b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-out.js new file mode 100644 index 000000000..b087c42fc --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-IfThenElseNoBraces-out.js @@ -0,0 +1 @@ +if(true)document.write("foo");else document.write("bar"); \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-in.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-in.js new file mode 100644 index 000000000..503e07283 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-in.js @@ -0,0 +1,3 @@ + +var r = / a backslash\// ; + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-out.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-out.js new file mode 100644 index 000000000..e5c83770c --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpBackslash-out.js @@ -0,0 +1 @@ +var r=/ a backslash\//; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-in.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-in.js new file mode 100644 index 000000000..2741e74c2 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-in.js @@ -0,0 +1,3 @@ + + +var r = /simple/g ; diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-out.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-out.js new file mode 100644 index 000000000..bb530b0a1 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimple-out.js @@ -0,0 +1 @@ +var r=/simple/g; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-in.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-in.js new file mode 100644 index 000000000..c7dbdba3d --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-in.js @@ -0,0 +1,5 @@ + + + var r = / simple with whitespace /g ; + + diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-out.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-out.js new file mode 100644 index 000000000..5c2db510b --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpSimpleWhitespace-out.js @@ -0,0 +1 @@ +var r=/ simple with whitespace /g; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpString-in.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpString-in.js new file mode 100644 index 000000000..debb983e5 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpString-in.js @@ -0,0 +1,3 @@ + + var r = "fruit" ; + r.replace ( /fruit/g, "apple") ; diff --git a/_testing/unittests/lib/exe/js_js_compress/test-RegexpString-out.js b/_testing/unittests/lib/exe/js_js_compress/test-RegexpString-out.js new file mode 100644 index 000000000..92ffc7d47 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-RegexpString-out.js @@ -0,0 +1 @@ +var r="fruit";r.replace(/fruit/g,"apple"); \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-in.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-in.js new file mode 100644 index 000000000..0c84c66ec --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-in.js @@ -0,0 +1,2 @@ +var x = 0; + do x=x+1 while (x < 10); diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-out.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-out.js new file mode 100644 index 000000000..593e9a664 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementDoWhile-out.js @@ -0,0 +1 @@ +var x=0;do x=x+1 while(x<10); \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementForIn-in.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementForIn-in.js new file mode 100644 index 000000000..1b0aeb6ff --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementForIn-in.js @@ -0,0 +1,2 @@ +for ( var x in foo ) + document.write(x); diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementForIn-out.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementForIn-out.js new file mode 100644 index 000000000..95c85871e --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementForIn-out.js @@ -0,0 +1 @@ +for(var x in foo)document.write(x); \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementNew-in.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementNew-in.js new file mode 100644 index 000000000..61f357f34 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementNew-in.js @@ -0,0 +1 @@ +var x = new Object(); \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementNew-out.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementNew-out.js new file mode 100644 index 000000000..0d4ff7f58 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementNew-out.js @@ -0,0 +1 @@ +var x=new Object(); \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-in.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-in.js new file mode 100644 index 000000000..39ffc1239 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-in.js @@ -0,0 +1,4 @@ +var x = 1; +switch (x) { + case 1: document.write(1); +} \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-out.js b/_testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-out.js new file mode 100644 index 000000000..e51c07371 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StatementSwitchCase-out.js @@ -0,0 +1 @@ +var x=1;switch(x){case 1:document.write(1);} \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-in.js b/_testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-in.js new file mode 100644 index 000000000..57fe13b90 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-in.js @@ -0,0 +1,3 @@ + +var s1 = "double \"quotes\"" ; +var s2 = "'test'" ; diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-out.js b/_testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-out.js new file mode 100644 index 000000000..9f91fc83d --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StringDoubleQuotes-out.js @@ -0,0 +1 @@ +var s1="double \"quotes\"";var s2="'test'"; \ No newline at end of file diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-in.js b/_testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-in.js new file mode 100644 index 000000000..bb5f9951a --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-in.js @@ -0,0 +1,8 @@ + +var s1 = 'single \'quotes\' ' ; + +var s2= '/* test */' ; + +var s3 = '// test' ; + +var s4 = '"test"' ; diff --git a/_testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-out.js b/_testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-out.js new file mode 100644 index 000000000..f38b26544 --- /dev/null +++ b/_testing/unittests/lib/exe/js_js_compress/test-StringSingleQuotes-out.js @@ -0,0 +1 @@ +var s1='single \'quotes\' ';var s2='/* test */';var s3='// test';var s4='"test"'; \ No newline at end of file -- GitLab