From 513bd1a733f06522c599b7a95e1966c9da098395 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 4 Feb 2014 23:49:25 -0500 Subject: [PATCH] Added test case for visibility escalation internally For completeness, since this is how I originally observed the issue fixed in the previous commit. --- test/Class/VisibilityTest.js | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/Class/VisibilityTest.js b/test/Class/VisibilityTest.js index 944a71d..164e90c 100644 --- a/test/Class/VisibilityTest.js +++ b/test/Class/VisibilityTest.js @@ -711,6 +711,43 @@ require( 'common' ).testCase( }, + /** + * Similar to above test, but ensure that overrides also take effect via + * the internal visibility object. + */ + 'Protected method overrides are observable by supertype': function() + { + var _self = this, + called = false; + + var C = this.Class( + { + 'public doFoo': function() + { + // will be overridden + return this.foo(); + }, + + // will be overridden + 'virtual protected foo': function() + { + _self.fail( true, false, "Method not overridden" ); + }, + } ) + .extend( + { + // should be invoked by doFoo; visibiility escalation + 'public override foo': function() + { + called = true; + }, + } ); + + C().doFoo(); + this.assertOk( called ); + }, + + /** * There was an issue where the private property object was not proxying * values to the true protected values. This would mean that when the parent