Index: trunk/phase3/tests/phpunit/includes/libs/JavaScriptMinifierTest.php |
— | — | @@ -57,7 +57,20 @@ |
58 | 58 | array( "x:{}/ x/g", "x:{}/ x/g" ), |
59 | 59 | array( "switch(x){case y?z:{}/ x/g:{}/ x/g;}", "switch(x){case y?z:{}/x/g:{}/ x/g;}" ), |
60 | 60 | array( "function x(){}/ x/g", "function x(){}/ x/g" ), |
61 | | - array( "+function x(){}/ x/g", "+function x(){}/x/g" ) |
| 61 | + array( "+function x(){}/ x/g", "+function x(){}/x/g" ), |
| 62 | + |
| 63 | + // Tests for things that broke in the past |
| 64 | + // Multiline quoted string |
| 65 | + array( "var foo=\"\\\nblah\\\n\";", "var foo=\"\\\nblah\\\n\";" ), |
| 66 | + // Multiline quoted string followed by string with spaces |
| 67 | + array( "var foo=\"\\\nblah\\\n\";\nvar baz = \" foo \";\n", "var foo=\"\\\nblah\\\n\";var baz=\" foo \";" ), |
| 68 | + // URL in quoted string ( // is not a comment) |
| 69 | + array( "aNode.setAttribute('href','http://foo.bar.org/baz');", "aNode.setAttribute('href','http://foo.bar.org/baz');" ), |
| 70 | + // URL in quoted string after multiline quoted string |
| 71 | + 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');" ), |
| 72 | + // Division vs. regex nastiness |
| 73 | + array( "alert( (10+10) / '/'.charCodeAt( 0 ) + '//' );", "alert((10+10)/'/'.charCodeAt(0)+'//');" ), |
| 74 | + array( "if(1)/a /g.exec('Pa ss');", "if(1)/a /g.exec('Pa ss');" ), |
62 | 75 | ); |
63 | 76 | } |
64 | 77 | |