1
0
Fork 0

Instantiating test object only once

closure/master
Mike Gerwitz 2010-12-29 21:18:03 -05:00
parent 96909732db
commit 83cecb5fdc
2 changed files with 10 additions and 5 deletions

View File

@ -70,7 +70,8 @@ for ( var prop in sub_props )
assert.ok( assert.ok(
( new SubFoo() instanceof Foo ), ( new SubFoo() instanceof Foo ),
"Subtypes must be considered to be instances of their supertypes" "Subtypes are considered to be instances of their supertypes " +
"(via instanceof operator)"
); );

View File

@ -50,6 +50,9 @@ assert.ok(
); );
var inst = new Foo();
// //
// isClass // isClass
assert.ok( assert.ok(
@ -58,7 +61,7 @@ assert.ok(
); );
assert.ok( assert.ok(
( !( Class.isClass( new Foo() ) ) ), !( Class.isClass( inst ) ),
"Class instances are not considered to be classes (they are objects)" "Class instances are not considered to be classes (they are objects)"
); );
@ -66,7 +69,7 @@ assert.ok(
// //
// isClassInstance // isClassInstance
assert.ok( assert.ok(
( Class.isClassInstance( new Foo() ) ), ( Class.isClassInstance( inst ) ),
"Class instances are considered to be classes instances" "Class instances are considered to be classes instances"
); );
@ -95,7 +98,7 @@ if ( Object.isFrozen )
// //
// isInstanceOf // isInstanceOf
assert.ok( assert.ok(
Class.isInstanceOf( Foo, new Foo() ), Class.isInstanceOf( Foo, inst ),
"Class instance is recognized by Class.isInstanceOf()" "Class instance is recognized by Class.isInstanceOf()"
); );
@ -105,7 +108,8 @@ assert.ok(
); );
assert.ok( assert.ok(
!( Class.isInstanceOf( new Foo(), Foo ) ), !( Class.isInstanceOf( inst, Foo ) ),
"Class is not an instance of its instance" "Class is not an instance of its instance"
); );