1
0
Fork 0

Made necessary changes to tests to prevent Closure Compiler from optimizing them away, causing test failures

closure/master
Mike Gerwitz 2011-12-06 18:28:16 -05:00
parent a18dedbddb
commit 58f2e3afc4
3 changed files with 13 additions and 3 deletions

View File

@ -230,7 +230,9 @@ require( 'common' ).testCase(
name,
function() {},
{ 'override': true },
{ member: function( a, b, c ) {} },
// this function returns each of its arguments, otherwise
// they'll be optimized away by Closure Compiler.
{ member: function( a, b, c ) { return [a,b,c]; } },
{ 'virtual': true }
);
} );

View File

@ -192,6 +192,9 @@ var ConcreteFoo = Class.extend( AbstractFoo,
{
method: function( one, two, three )
{
// prevent Closure Compiler from optimizing the arguments away, causing
// a definition failure
return [ one, two, three ];
},
second: function()
@ -391,8 +394,9 @@ var ConcreteFoo = Class.extend( AbstractFoo,
{
Class.extend( SubAbstractFoo,
{
// concrete, so the result would otherwise not be abstract
'method': function( one, two, three ) {},
// concrete, so the result would otherwise not be abstract (return
// args so they're not optimized away during compile)
'method': function( _, __, ___ ) { return [ _, __, ___ ]; },
// the problem
'toString': function() {},

View File

@ -79,6 +79,10 @@ var common = require( './common' ),
assert.equal( warning.message, err.message,
"Warning message should be taken from wrapped exception"
);
// this little trick prevents the compiler from optimizing away the
// assignment, which would break the test in certain versions of FF.
return _;
} )();