See Moritz Lenz' response to this thread on March 26. To summarize, you can use "trusts". Also having to do this may indicate bad code design. -- Darren Duncan

On 2015-05-11 2:13 PM, R. Ransbottom wrote:

I need to test some private routines, so is there a way to do that?

Is there a downsize to augment for this?

# source
class Dog {
     method bark { say( "#bark"); return "bark" }
     method !pee { say( "#pee" ); return "pee"}

# test

use Test;
use v6;
plan 4;

my Dog $t;

ok( Dog.bark eq  "bark", "Good loud Dog" );
ok( $t.bark eq  "bark", "Good loud dog" );

augment class Dog {     # augment should be a test
     # do private tests in private
      ok( Dog!pee eq "pee", "Good bad Dog" );
      ok( $t!pee eq "pee", "Good bad dog" );

Reply via email to