diff --git a/lib/class.js b/lib/class.js index ce480fc..9da0d7d 100644 --- a/lib/class.js +++ b/lib/class.js @@ -434,19 +434,19 @@ var extend = ( function( extending ) this.toString = ( cname ) ? function() { - return 'Object #<' + cname + '>'; + return '[object #<' + cname + '>]'; } : function() { - return 'Object #'; + return '[object #]'; } ; }; // provide a more intuitive string representation __self.toString = ( cname ) - ? function() { return ''; } - : function() { return ''; } + ? function() { return '[object Class <' + cname + '>]'; } + : function() { return '[object Class]'; } ; return __self; @@ -463,8 +463,14 @@ var extend = ( function( extending ) }; __abstract_self.toString = ( cname ) - ? function() { return ''; } - : function() { return ''; } + ? function() + { + return '[object AbstractClass <' + cname + '>]'; + } + : function() + { + return '[object AbstractClass]'; + } ; return __abstract_self; diff --git a/test/test-class-name.js b/test/test-class-name.js index c5237e6..aa05a5b 100644 --- a/test/test-class-name.js +++ b/test/test-class-name.js @@ -61,14 +61,14 @@ var common = require( './common' ), // concrete assert.equal( Class( {} ).toString(), - '', + '[object Class]', "Converting anonymous class to string yields class string" ); // abstract assert.equal( Class( { 'abstract foo': [] } ).toString(), - '', + '[object AbstractClass]', "Converting abstract anonymous class to string yields class string" ); } )(); @@ -85,14 +85,14 @@ var common = require( './common' ), // concrete assert.equal( Class( name, {} ).toString(), - '', + '[object Class <' + name + '>]', "Converting named class to string yields string with name of class" ); // abstract assert.equal( Class( name, { 'abstract foo': [] } ).toString(), - '', + '[object AbstractClass <' + name + '>]', "Converting abstract named class to string yields string with name " + "of class" ); @@ -114,7 +114,7 @@ var common = require( './common' ), // anonymous assert.equal( anon.toString(), - 'Object #', + '[object #]', "Converting anonymous class instance to string yields string " + "indiciating that the class is anonymous" ); @@ -122,7 +122,7 @@ var common = require( './common' ), // named assert.equal( named.toString(), - 'Object #<' + name + '>', + '[object #<' + name + '>]', "Converting named class instance to string yields string with name " + "of class" );