1
0
Fork 0

[#25] Moved bulk of visibility escalation test into common file to be shared with other member tests

closure/master
Mike Gerwitz 2011-10-28 20:22:14 -04:00
parent 93021f3dbc
commit 31a7980e37
2 changed files with 31 additions and 13 deletions

View File

@ -287,20 +287,11 @@ require( 'common' ).testCase(
*/
'Methods support visibility escalation or equality': function()
{
var tests = [
[ 'private', 'protected' ],
[ 'protected', 'public' ],
[ 'public', 'public' ],
[ 'protected', 'protected' ],
[ 'private', 'private' ]
];
for ( var i = 0, len = tests.length; i < len; i++ )
var _self = this;
shared.visEscalationTest( function( cur )
{
var cur = tests[ i ];
this.quickVisChangeTest( cur[ 0 ], cur[ 1 ], false );
}
_self.quickVisChangeTest( cur[ 0 ], cur[ 1 ], false );
} );
},

View File

@ -120,3 +120,30 @@ exports.quickKeywordTest = function( type, keywords, identifier, prev )
}
};
/**
* Passes test visibility levels [ x1, x2 ] to test method T to ensure that test
* T will pass when x2 is used to override a member declared using x1
*
* @param {function(function())} test test function
*
* @return {undefined}
*/
exports.visEscalationTest = function( test )
{
var tests = [
[ 'private', 'protected' ],
[ 'protected', 'public' ],
[ 'public', 'public' ],
[ 'protected', 'protected' ],
[ 'private', 'private' ]
];
for ( var i = 0, len = tests.length; i < len; i++ )
{
var cur = tests[ i ];
test( cur );
}
};