From 58f2e3afc42bc747a72af22125250239bb570db0 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 6 Dec 2011 18:28:16 -0500 Subject: [PATCH] Made necessary changes to tests to prevent Closure Compiler from optimizing them away, causing test failures --- test/MemberBuilderValidator/MethodTest.js | 4 +++- test/test-class-abstract.js | 8 ++++++-- test/test-warn-exception.js | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/MemberBuilderValidator/MethodTest.js b/test/MemberBuilderValidator/MethodTest.js index c1cea30..0bada10 100644 --- a/test/MemberBuilderValidator/MethodTest.js +++ b/test/MemberBuilderValidator/MethodTest.js @@ -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 } ); } ); diff --git a/test/test-class-abstract.js b/test/test-class-abstract.js index 660967e..ae63bfb 100644 --- a/test/test-class-abstract.js +++ b/test/test-class-abstract.js @@ -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() {}, diff --git a/test/test-warn-exception.js b/test/test-warn-exception.js index be51031..0b59b61 100644 --- a/test/test-warn-exception.js +++ b/test/test-warn-exception.js @@ -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 _; } )();