diff --git a/lib/class.js b/lib/class.js index 4eaac7e..a4b293b 100644 --- a/lib/class.js +++ b/lib/class.js @@ -113,7 +113,7 @@ module.exports.implement = function() { // implement on empty base return createImplement( - module.exports.extend(), + null, Array.prototype.slice.call( arguments ) ); }; diff --git a/test/test-class-implement.js b/test/test-class-implement.js index 54bf454..0bdad6e 100644 --- a/test/test-class-implement.js +++ b/test/test-class-implement.js @@ -213,3 +213,22 @@ var Type = Interface.extend( { ); } )(); + +/** + * Opposite of the above test. If a parent wasn't specified to begin with, then + * we're fine to specify it in extend(). + */ +( function testCanSpecifyParentIfImplementingAtopEmptyClass() +{ + assert.doesNotThrow( + function() + { + // this /should/ work + Class.implement( Type ).extend( PlainFoo, {} ); + }, + Error, + "Can specify parent for exetnd() when implementing atop an " + + "empty base" + ); +} )(); +