- public function testExponentLineBreaking( $num ) {
- // Long line breaking was being incorrectly done between the base and
- // exponent part of a number, causing a syntax error. The line should
- // instead break at the start of the number. (T34548)
- $prefix = 'var longVarName' . str_repeat( '_', 973 ) . '=';
- $suffix = ',shortVarName=0;';
-
- $input = $prefix . $num . $suffix;
- $expected = $prefix . "\n" . $num . $suffix;
-
- $minified = JavaScriptMinifier::minify( $input );
-
- $this->assertEquals( $expected, $minified, "Line breaks must not occur in middle of exponent" );
+ public function testLineBreaker( $code, array $expectedLines ) {
+ $this->setMaxLineLength( 1 );
+ $actual = JavaScriptMinifier::minify( $code );
+ $this->assertEquals(
+ array_merge( [ '' ], $expectedLines ),
+ explode( "\n", $actual )
+ );