Merge "language: Add generate-normalize-data maintenance script"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / JavaScriptMinifierTest.php
index 3e37f15..16048bf 100644 (file)
@@ -165,9 +165,6 @@ class JavaScriptMinifierTest extends PHPUnit\Framework\TestCase {
                        ],
                        [ "if(1)/a /g.exec('Pa ss');", "if(1)/a /g.exec('Pa ss');" ],
 
-                       // newline insertion after 1000 chars: break after the "++", not before
-                       [ str_repeat( ';', 996 ) . "if(x++);", str_repeat( ';', 996 ) . "if(x++\n);" ],
-
                        // Unicode letter characters should pass through ok in identifiers (T33187)
                        [ "var KaŝSkatolVal = {}", 'var KaŝSkatolVal={}' ],
 
@@ -250,9 +247,21 @@ class JavaScriptMinifierTest extends PHPUnit\Framework\TestCase {
                                        ';',
                                ],
                        ],
+                       [
+                               // Must not break before '++'
+                               'if(x++);',
+                               [
+                                       'if',
+                                       '(',
+                                       'x++',
+                                       ')',
+                                       ';',
+                               ],
+                       ],
                        [
                                // Regression test for T201606.
                                // Must not break between 'return' and Expression.
+                               // Was caused by bad state after '{}' in property value.
                                <<<JAVASCRIPT
                        call( function () {
                                try {
@@ -304,7 +313,41 @@ JAVASCRIPT
                                        ')',
                                        ';',
                                ]
-                       ]
+                       ],
+                       [
+                               // Regression test for T201606.
+                               // Must not break between 'return' and Expression.
+                               // FIXME: Cause?
+                               <<<JAVASCRIPT
+call( {
+       key: 1 ? 0 : function () {
+               return this;
+       }
+} );
+JAVASCRIPT
+                               ,
+                               [
+                                       'call',
+                                       '(',
+                                       '{',
+                                       'key',
+                                       ':',
+                                       '1',
+                                       '?',
+                                       '0',
+                                       ':',
+                                       'function',
+                                       '(',
+                                       ')',
+                                       '{',
+                                       'return', 'this', // FIXME
+                                       ';',
+                                       '}',
+                                       '}',
+                                       ')',
+                                       ';',
+                               ]
+                       ],
                ];
        }