mirror of
https://github.com/mrclay/minify.git
synced 2025-01-17 21:28:14 +01:00
add test for closure compiler tags validation
https://code.google.com/p/closure-compiler/issues/detail?id=513
This commit is contained in:
parent
6998e61654
commit
f5c12ad0f4
@ -62,9 +62,27 @@ class MinifyClosureCompilerTest extends TestCase
|
||||
$this->assertHasJar();
|
||||
$src = "function unused() {};";
|
||||
$minExpected = '';
|
||||
$minOutput = Minify_ClosureCompiler::minify($src, array(
|
||||
$options = array(
|
||||
Minify_ClosureCompiler::OPTION_COMPILATION_LEVEL => 'ADVANCED_OPTIMIZATIONS'
|
||||
));
|
||||
);
|
||||
$minOutput = Minify_ClosureCompiler::minify($src, $options);
|
||||
$this->assertSame($minExpected, $minOutput, 'advanced optimizations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that closure compiler does not produce unneeded noise
|
||||
*
|
||||
* @see https://code.google.com/p/closure-compiler/issues/detail?id=513
|
||||
*
|
||||
* NOTE: this test does not actually cover it, result is manually verified.
|
||||
*/
|
||||
public function test4()
|
||||
{
|
||||
$this->assertHasJar();
|
||||
|
||||
$src = file_get_contents(self::$test_files . '/bug-513.js');
|
||||
$minExpected = 'var a=4;';
|
||||
$minOutput = Minify_ClosureCompiler::minify($src);
|
||||
$this->assertSame($minExpected, $minOutput, 'advanced optimizations');
|
||||
}
|
||||
|
||||
@ -77,4 +95,4 @@ class MinifyClosureCompilerTest extends TestCase
|
||||
$this->markTestSkipped($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
tests/_test_files/bug-513.js
Normal file
17
tests/_test_files/bug-513.js
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
// fragment downloaded from jquery-cookie 1.0
|
||||
// https://raw.githubusercontent.com/carhartl/jquery-cookie/v1.0/jquery.cookie.js
|
||||
// see https://code.google.com/p/closure-compiler/issues/detail?id=513
|
||||
|
||||
/**
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||||
* used when the cookie was set.
|
||||
*/
|
||||
var a=1+3;
|
Loading…
x
Reference in New Issue
Block a user