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, name,
function() {}, function() {},
{ 'override': true }, { '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 } { 'virtual': true }
); );
} ); } );

View File

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

View File

@ -79,6 +79,10 @@ var common = require( './common' ),
assert.equal( warning.message, err.message, assert.equal( warning.message, err.message,
"Warning message should be taken from wrapped exception" "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 _;
} )(); } )();