ClassBuilder.isInstanceOf() will no longer throw errors when given undefined for either argument
- Yes, this is just quickly adding a test to a pre-existing, terrible format. This will be refactored with the rest of the test case.closure/master
parent
6c379968bc
commit
8e079129f3
|
@ -230,6 +230,11 @@ exports.isInstanceOf = function( type, instance )
|
|||
{
|
||||
var meta, implemented, i;
|
||||
|
||||
if ( !( type && instance ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// check prototype chain (will throw an error if type is not a
|
||||
|
|
|
@ -102,6 +102,16 @@ assert.ok(
|
|||
"Class instance is recognized by Class.isInstanceOf()"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
Class.isInstanceOf( Foo, undefined ) === false,
|
||||
"Checking instance of undefined will not throw an error"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
Class.isInstanceOf( undefined, {} ) === false,
|
||||
"Checking for instance of undefined will not throw an error"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
!( Class.isInstanceOf( Foo, Foo ) ),
|
||||
"Class is not an instance of itself when uninstantiated"
|
||||
|
|
Loading…
Reference in New Issue