1
0
Fork 0

Test ensuring `#use` staging object satisfies `Class.isClass`

master
Mike Gerwitz 2015-05-27 23:38:07 -04:00
parent 867127ed2f
commit f3a8dea25d
2 changed files with 20 additions and 6 deletions

View File

@ -78,11 +78,5 @@ complete.
improvement. Until that time, be mindful of the performance test
cases in the =test/perf= directory.
* TODO Intermediate object as class
The immediate syntax---=Foo.use(T)()=---is a short-hand equivalent
of =Foo.use(T).extend({})()=. As such, for consistency, =Class.isA=
should consider the intermediate object returned by a call to =use=
to be a class.
If we are to do so, though, we must make sure that the entire class
API is supported.

View File

@ -455,4 +455,24 @@ require( 'common' ).testCase(
Sut( dfn );
} );
},
/**
* The stating object rendered by `#use` calls implement the same
* methods as classes, and are even treated as classes when invoked
* using the immediate syntax (see ImmediateTest). When defining
* abstract classes, staging objects may be extended as if they were
* classes (see AbstractTest).
*
* It makes sense for staging objects to be able to be treated as if
* they were classes, which demands reflection API consistency.
*/
'Staging object for eventual mixin is considered to be class': function()
{
var T = this.Sut( {} );
this.assertOk(
this.Class.isClass( this.Class( {} ).use( T ) )
);
},
} );