From 02d0c07f98185f05a81e29fca43128642d44e042 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 27 Jan 2011 22:39:52 -0500 Subject: [PATCH] Extended existing visibility tests to include methods --- test/test-class-visibility.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test-class-visibility.js b/test/test-class-visibility.js index 2cb6963..6f2647f 100644 --- a/test/test-class-visibility.js +++ b/test/test-class-visibility.js @@ -30,11 +30,19 @@ var common = require( './common' ), prot = 'bar', priv = 'baz', + pubf = function() {}, + protf = function() {}, + privf = function() {}, + // new anonymous class instance foo = Class.extend( { 'public pub': pub, 'protected peeps': prot, 'private parts': priv, + + 'public pubf': pubf, + 'protected protf': protf, + 'private privf': privf, })(); @@ -45,6 +53,12 @@ var common = require( './common' ), pub, "Public properties are accessible via public interface" ); + + assert.equal( + foo.pubf, + pubf, + "Public methods are accessible via public interface" + ); } )(); @@ -61,5 +75,17 @@ var common = require( './common' ), undefined, "Private properties are inaccessible via public interface" ); + + assert.equal( + foo.protf, + undefined, + "Protected methods are inaccessible via public interface" + ); + + assert.equal( + foo.privf, + undefined, + "Private methods are inaccessible via public interface" + ); } )();