From ef457c67624460b5703178e7b11edc2f9fffda01 Mon Sep 17 00:00:00 2001 From: Pierre Paysant-Le Roux Date: Thu, 5 Nov 2009 22:34:52 +0100 Subject: Fix js_compress regexp detection Ignore-this: ffb20375a09483502d61241d76877a8d darcs-hash:20091105213452-533a7-f09aca121cf24a8b6ad2d3448d058a846cb52182.gz --- _test/cases/lib/exe/js_js_compress.test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to '_test') diff --git a/_test/cases/lib/exe/js_js_compress.test.php b/_test/cases/lib/exe/js_js_compress.test.php index bd00c9c4f..b7de9257d 100644 --- a/_test/cases/lib/exe/js_js_compress.test.php +++ b/_test/cases/lib/exe/js_js_compress.test.php @@ -44,6 +44,21 @@ class js_js_compress_test extends UnitTestCase { $this->assertEqual(js_compress($text), 'foo.split(/[a-Z\/]*/);'); } + function test_regex_in_array(){ + $text = '[/"/ , /"/ , /"/]'; + $this->assertEqual(js_compress($text), '[/"/,/"/,/"/]'); + } + + function test_regex_in_hash(){ + $text = '{ a : /"/ }'; + $this->assertEqual(js_compress($text), '{a:/"/}'); + } + + function test_regex_preceded_by_spaces_caracters(){ + $text = "text.replace( \t \r\n /\"/ , ".'"//" )'; + $this->assertEqual(js_compress($text), 'text.replace(/"/,"//")'); + } + function test_dquot1(){ $text = 'var foo="Now what \\" \'do we//get /*here*/ ?";'; $this->assertEqual(js_compress($text), $text); -- cgit v1.2.3