Re: Can a user "cheat" and call a class's private method?

2015-05-14 Thread R. Ransbottom
On Tue, May 12, 2015 at 11:03:01PM +0200, Moritz Lenz wrote: > I'm curious, what's a case where private state of a class needs to be > tested, and tests agains the public interface are not enough? > In my experience, testing against private parts only makes the tests > more brittle (that is, ever

Re: Can a user "cheat" and call a class's private method?

2015-05-12 Thread R. Ransbottom
On Mon, May 11, 2015 at 03:22:46PM -0700, Darren Duncan wrote: > you can use "trusts". Also having to do this may indicate bad code > design. -- Darren Duncan I saw Moritz' and Carl's responses and I agree with the smell issue. Given that the code exists and needs testing, 'augment' seems pre

Re: Can a user "cheat" and call a class's private method?

2015-05-11 Thread R. Ransbottom
> 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 MONKEY_TYPING; use Test; use v6; plan 4; my Dog