From: Roan Kattouw Date: Mon, 14 Mar 2011 13:55:42 +0000 (+0000) Subject: Per Nikerabbit, add some minifier tests for historic failure cases that I had lying... X-Git-Tag: 1.31.0-rc.0~31422 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=5ce4ecfced94a9c797189012c144a024938d1664;p=lhc%2Fweb%2Fwiklou.git Per Nikerabbit, add some minifier tests for historic failure cases that I had lying around --- diff --git a/tests/phpunit/includes/libs/JavaScriptMinifierTest.php b/tests/phpunit/includes/libs/JavaScriptMinifierTest.php index 82de53d1b3..3f2209d394 100644 --- a/tests/phpunit/includes/libs/JavaScriptMinifierTest.php +++ b/tests/phpunit/includes/libs/JavaScriptMinifierTest.php @@ -57,7 +57,20 @@ class JavaScriptMinifierTest extends MediaWikiTestCase { array( "x:{}/ x/g", "x:{}/ x/g" ), array( "switch(x){case y?z:{}/ x/g:{}/ x/g;}", "switch(x){case y?z:{}/x/g:{}/ x/g;}" ), array( "function x(){}/ x/g", "function x(){}/ x/g" ), - array( "+function x(){}/ x/g", "+function x(){}/x/g" ) + array( "+function x(){}/ x/g", "+function x(){}/x/g" ), + + // Tests for things that broke in the past + // Multiline quoted string + array( "var foo=\"\\\nblah\\\n\";", "var foo=\"\\\nblah\\\n\";" ), + // Multiline quoted string followed by string with spaces + array( "var foo=\"\\\nblah\\\n\";\nvar baz = \" foo \";\n", "var foo=\"\\\nblah\\\n\";var baz=\" foo \";" ), + // URL in quoted string ( // is not a comment) + array( "aNode.setAttribute('href','http://foo.bar.org/baz');", "aNode.setAttribute('href','http://foo.bar.org/baz');" ), + // URL in quoted string after multiline quoted string + array( "var foo=\"\\\nblah\\\n\";\naNode.setAttribute('href','http://foo.bar.org/baz');", "var foo=\"\\\nblah\\\n\";aNode.setAttribute('href','http://foo.bar.org/baz');" ), + // Division vs. regex nastiness + array( "alert( (10+10) / '/'.charCodeAt( 0 ) + '//' );", "alert((10+10)/'/'.charCodeAt(0)+'//');" ), + array( "if(1)/a /g.exec('Pa ss');", "if(1)/a /g.exec('Pa ss');" ), ); }