From bad31ae944f074dab12f7a6d1362775d8f2b18dd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 29 Oct 2005 02:26:52 +0200 Subject: JavaScript refactoring This patch addes a first go on a central javascript and CSS dispatcher which builds a single script from all needed scripts, does optimizing and caching. darcs-hash:20051029002652-7ad00-7558b569c2bf65f5e41820644580d97c62edd0d6.gz --- _test/cases/lib/exe/jscss_js_compress.test.php | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 _test/cases/lib/exe/jscss_js_compress.test.php (limited to '_test') diff --git a/_test/cases/lib/exe/jscss_js_compress.test.php b/_test/cases/lib/exe/jscss_js_compress.test.php new file mode 100644 index 000000000..3d9a8b627 --- /dev/null +++ b/_test/cases/lib/exe/jscss_js_compress.test.php @@ -0,0 +1,68 @@ +assertEqual(js_compress($text), ''); + } + + function test_mlcom2(){ + $text = 'var foo=6;/* another comment */'; + $this->assertEqual(js_compress($text), 'var foo=6;'); + } + + function test_slcom1(){ + $text = '// an comment'; + $this->assertEqual(js_compress($text), ''); + } + + function test_slcom2(){ + $text = 'var foo=6;// another comment '; + $this->assertEqual(js_compress($text), 'var foo=6;'); + } + + function test_slcom3(){ + $text = 'var foo=6;// another comment / or something with // comments '; + $this->assertEqual(js_compress($text), 'var foo=6;'); + } + + function test_regex1(){ + $text = 'foo.split( /[a-Z\/]*/ );'; + $this->assertEqual(js_compress($text), 'foo.split(/[a-Z\/]*/);'); + } + + function test_dquot1(){ + $text = 'var foo="Now what \'do we//get /*here*/ ?";'; + $this->assertEqual(js_compress($text), $text); + } + + function test_squot1(){ + $text = "var foo='Now what \"do we//get /*here*/ ?';"; + $this->assertEqual(js_compress($text), $text); + } + + function test_nl1(){ + $text = "var foo=6;\nvar baz=7;"; + $this->assertEqual(js_compress($text), 'var foo=6;var baz=7;'); + } + + function test_lws1(){ + $text = " \t var foo=6;"; + $this->assertEqual(js_compress($text), 'var foo=6;'); + } + + function test_tws1(){ + $text = "var foo=6; \t "; + $this->assertEqual(js_compress($text), 'var foo=6;'); + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3