1
0
Fork 0

[#25] [#25] Added member builder tests for private and protected members

closure/master
Mike Gerwitz 2011-10-21 10:29:24 -04:00
parent ea972bdffc
commit aeff796332
1 changed files with 22 additions and 11 deletions

View File

@ -22,9 +22,6 @@
* @package test * @package test
*/ */
require( 'common' ).testCase( require( 'common' ).testCase(
{ {
caseSetUp: function() caseSetUp: function()
@ -63,6 +60,8 @@ require( 'common' ).testCase(
{ {
var found = false; var found = false;
this.incAssertCount();
for ( level in this.members ) for ( level in this.members )
{ {
if ( typeof this.members[ level ][ name ] === 'undefined' ) if ( typeof this.members[ level ][ name ] === 'undefined' )
@ -86,8 +85,8 @@ require( 'common' ).testCase(
this.basicVisPropTest = function( vis ) this.basicVisPropTest = function( vis )
{ {
var name = 'pub', var name = vis + 'name',
val = 'val'; val = vis + 'val';
this.buildStubProp( name, val, vis ); this.buildStubProp( name, val, vis );
this.assertEqual( this.members[ vis ][ name ][ 0 ], val ); this.assertEqual( this.members[ vis ][ name ][ 0 ], val );
@ -98,8 +97,8 @@ require( 'common' ).testCase(
this.basicVisMethodTest = function( vis ) this.basicVisMethodTest = function( vis )
{ {
var name = 'pub', var name = vis + 'name',
val = 'val'; val = vis + 'val';
this.buildStubMethod( name, val, vis ); this.buildStubMethod( name, val, vis );
@ -128,14 +127,26 @@ require( 'common' ).testCase(
}, },
'Public properties are accessible only via the public interface': function() 'Properties are only accessible via their respective interfaces': function()
{ {
this.basicVisPropTest( 'public' ); var _self = this,
tests = [ 'public', 'protected', 'private' ];
for ( i in tests )
{
_self.basicVisPropTest( tests[ i ] );
};
}, },
'Public methods are accessible only via the public interface': function() 'Methods are only accessible via their respective interfaces': function()
{ {
this.basicVisMethodTest( 'public' ); var _self = this;
tests = [ 'public', 'protected', 'private' ];
for ( i in tests )
{
_self.basicVisMethodTest( tests[ i ] );
};
}, },
} ); } );