From aeff796332b3f5f162b3d1b5a8bfc9ee765dd7ff Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 21 Oct 2011 10:29:24 -0400 Subject: [PATCH] [#25] [#25] Added member builder tests for private and protected members --- test/MemberBuilder/VisibilityTest.js | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/test/MemberBuilder/VisibilityTest.js b/test/MemberBuilder/VisibilityTest.js index b2df403..8149ab5 100644 --- a/test/MemberBuilder/VisibilityTest.js +++ b/test/MemberBuilder/VisibilityTest.js @@ -22,9 +22,6 @@ * @package test */ - - - require( 'common' ).testCase( { caseSetUp: function() @@ -63,6 +60,8 @@ require( 'common' ).testCase( { var found = false; + this.incAssertCount(); + for ( level in this.members ) { if ( typeof this.members[ level ][ name ] === 'undefined' ) @@ -86,8 +85,8 @@ require( 'common' ).testCase( this.basicVisPropTest = function( vis ) { - var name = 'pub', - val = 'val'; + var name = vis + 'name', + val = vis + 'val'; this.buildStubProp( name, val, vis ); this.assertEqual( this.members[ vis ][ name ][ 0 ], val ); @@ -98,8 +97,8 @@ require( 'common' ).testCase( this.basicVisMethodTest = function( vis ) { - var name = 'pub', - val = 'val'; + var name = vis + 'name', + val = vis + 'val'; 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 ] ); + }; }, } );