From 74dd239de00073fa609493c28521d42d6508182c Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sun, 4 Dec 2011 19:26:53 -0500 Subject: [PATCH] Corrected errors/warnings as indicated by Google Closure compiler --- test/inc-testcase.js | 2 +- test/test-class-abstract.js | 12 ++++++------ test/test-class-constructor.js | 4 ++-- test/test-class-extend.js | 10 +++++----- test/test-class-parent.js | 2 +- test/test-class_builder-final.js | 4 ++-- test/test-class_builder-member-restrictions.js | 6 +++--- test/test-util-abstract.js | 2 +- test/test-util-copy.js | 8 ++++---- test/test-warn-exception.js | 8 ++++---- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/test/inc-testcase.js b/test/inc-testcase.js index 429fcf9..d39e632 100644 --- a/test/inc-testcase.js +++ b/test/inc-testcase.js @@ -322,7 +322,7 @@ function prepareCaseContext() assertDeepEqual: assert_wrapped.deepEqual, assertStrictEqual: assert_wrapped.strictEqual, assertNotStrictEqual: assert_wrapped.notStrictEqual, - assertThrows: assert_wrapped.throws, + assertThrows: assert_wrapped['throws'], assertDoesNotThrow: assert_wrapped.doesNotThrow, assertIfError: assert_wrapped.ifError, incAssertCount: incAssertCount, diff --git a/test/test-class-abstract.js b/test/test-class-abstract.js index cab0209..660967e 100644 --- a/test/test-class-abstract.js +++ b/test/test-class-abstract.js @@ -256,7 +256,7 @@ var ConcreteFoo = Class.extend( AbstractFoo, ( function testAbstractClassesCannotBeInstantiated() { - assert.throws( function() + assert['throws']( function() { // both should fail AbstractFoo(); @@ -289,7 +289,7 @@ var ConcreteFoo = Class.extend( AbstractFoo, ( function testConcreteMethodsMustImplementTheProperNumberOfArguments() { - assert.throws( function() + assert['throws']( function() { AbstractFoo.extend( { @@ -304,7 +304,7 @@ var ConcreteFoo = Class.extend( AbstractFoo, ( function testAbstractMethodsOfSubtypesMustImplementProperNumberOfArguments() { - assert.throws( + assert['throws']( function() { AbstractFoo.extend( @@ -360,7 +360,7 @@ var ConcreteFoo = Class.extend( AbstractFoo, ( function testAbstractMethodsMustBeDeclaredAsArrays() { - assert.throws( function() + assert['throws']( function() { Class.extend( { @@ -424,7 +424,7 @@ var ConcreteFoo = Class.extend( AbstractFoo, anon_named = AbstractClass.extend( AbstractFoo, {} ); // named - assert.throws( + assert['throws']( function() { // should throw an error, since we're not declaring it as abstract @@ -436,7 +436,7 @@ var ConcreteFoo = Class.extend( AbstractFoo, ); // anonymous - assert.throws( + assert['throws']( function() { // should throw an error, since we're not declaring it as abstract diff --git a/test/test-class-constructor.js b/test/test-class-constructor.js index 6d0fa73..5544587 100644 --- a/test/test-class-constructor.js +++ b/test/test-class-constructor.js @@ -157,12 +157,12 @@ assert.ok( */ ( function testConstructorCannotBeDeclaredAsProtectedOrPrivate() { - assert.throws( function() + assert['throws']( function() { Class( { 'protected __construct': function() {} } ); }, TypeError, "Constructor cannot be protected" ); - assert.throws( function() + assert['throws']( function() { Class( { 'private __construct': function() {} } ); }, TypeError, "Constructor cannot be private" ); diff --git a/test/test-class-extend.js b/test/test-class-extend.js index 4fdcf73..d67d3e4 100644 --- a/test/test-class-extend.js +++ b/test/test-class-extend.js @@ -166,7 +166,7 @@ for ( var i = 0; i < class_count; i++ ) ); - assert.throws( function() + assert['throws']( function() { Class.extend( OtherClass, { @@ -224,7 +224,7 @@ for ( var i = 0; i < class_count; i++ ) "Subtypes can override parent property values" ); - assert.throws( function() + assert['throws']( function() { Class.extend( { @@ -249,7 +249,7 @@ for ( var i = 0; i < class_count; i++ ) ( function testInvokingClassModuleRequiresObjectAsArgumentIfCreating() { - assert.throws( function() + assert['throws']( function() { Class( 'moo' ); Class( 5 ); @@ -321,7 +321,7 @@ for ( var i = 0; i < class_count; i++ ) */ ( function testCannotProvideDuplicateMemberDefintions() { - assert.throws( function() + assert['throws']( function() { Class( { @@ -334,7 +334,7 @@ for ( var i = 0; i < class_count; i++ ) } ); }, Error, "Cannot redeclare property in same class definition" ); - assert.throws( function() + assert['throws']( function() { Class( { diff --git a/test/test-class-parent.js b/test/test-class-parent.js index a04f636..ea25903 100644 --- a/test/test-class-parent.js +++ b/test/test-class-parent.js @@ -104,7 +104,7 @@ assert.equal( "Arguments should be passed to super method via _super argument list" ); -assert.throws( function() +assert['throws']( function() { Foo.extend( { diff --git a/test/test-class_builder-final.js b/test/test-class_builder-final.js index 6693270..47736ab 100644 --- a/test/test-class_builder-final.js +++ b/test/test-class_builder-final.js @@ -81,13 +81,13 @@ var common = require( './common' ), ; // named - assert.throws( function() + assert['throws']( function() { FinalNamed.extend( {} ); }, Error, "Cannot extend final named subtype" ); // anonymous - assert.throws( function() + assert['throws']( function() { FinalAnon.extend( {} ); }, Error, "Cannot extend final anonymous subtype" ); diff --git a/test/test-class_builder-member-restrictions.js b/test/test-class_builder-member-restrictions.js index 6019865..ea09523 100644 --- a/test/test-class_builder-member-restrictions.js +++ b/test/test-class_builder-member-restrictions.js @@ -88,7 +88,7 @@ var common = require( './common' ), for ( name in reserved ) { // properties - assert.throws( + assert['throws']( function() { var obj = {}; @@ -102,7 +102,7 @@ var common = require( './common' ), ); // methods - assert.throws( + assert['throws']( function() { var obj = {}; @@ -179,7 +179,7 @@ var common = require( './common' ), // test each of the reserved members for ( name in pub ) { - assert.throws( function() + assert['throws']( function() { var obj = {}; obj[ name ] = function() {}; diff --git a/test/test-util-abstract.js b/test/test-util-abstract.js index 10185d3..f8abfec 100644 --- a/test/test-util-abstract.js +++ b/test/test-util-abstract.js @@ -38,7 +38,7 @@ assert.ok( "util.isAbstractMethod" ); -assert.throws( function() +assert['throws']( function() { util.createAbstractMethod()(); }, Error, "Abstract methods cannot be called" ); diff --git a/test/test-util-copy.js b/test/test-util-copy.js index 2e76f09..3394558 100644 --- a/test/test-util-copy.js +++ b/test/test-util-copy.js @@ -121,22 +121,22 @@ var common = require( './common' ), */ ( function testThrowsErrorIfSourceOrDestAreNotGiven() { - assert.throws( function() + assert['throws']( function() { copyTo(); }, TypeError, "Dest parameter is required" ); - assert.throws( function() + assert['throws']( function() { copyTo( 'bla', {} ); }, TypeError, "Dest parameter is required to be an object" ); - assert.throws( function() + assert['throws']( function() { copyTo( {} ); }, TypeError, "Src parameter is required" ); - assert.throws( function() + assert['throws']( function() { copyTo( {}, 'foo' ); }, TypeError, "Src parameter is required to be an object" ); diff --git a/test/test-warn-exception.js b/test/test-warn-exception.js index dbc547c..be51031 100644 --- a/test/test-warn-exception.js +++ b/test/test-warn-exception.js @@ -71,8 +71,8 @@ var common = require( './common' ), // bug in FF (tested with 8.0) where, without accessing the message property // in this test before passing it to Warning, err.message === "" within the - // Warning ctor. - err.message; + // Warning ctor. (Assignment is to silence Closure compiler warning.) + var _ = err.message; var warning = Warning( err ); @@ -88,12 +88,12 @@ var common = require( './common' ), */ ( function testThrowsExceptionIfNoExceptionIsWrapped() { - assert.throws( function() + assert['throws']( function() { Warning( /* nothing provided to wrap */ ); }, TypeError, "Exception should be thrown if no exception is provided" ); - assert.throws( function() + assert['throws']( function() { Warning( 'not an exception' ); }, TypeError, "Exception should be thrown if given value is not an Error" );