pdl / Test-Proto

OO test script golf sugar
1 stars 1 forks source link

ok and validate to take $_ implicitly #20

Closed pdl closed 11 years ago

pdl commented 11 years ago

It would be good for ok and validate methods, when called without arguments, to infer $_ as the test subject, so you can do things like while (<>){ say ($pLine->ok ? $_ : '') };

But make sure that p->ok(undef) does not take $_.

pdl commented 11 years ago

Would it work for p in boolean context to do p->validate($_)? Then you could do fun things like for (@_){ tr/a-z/A-Z/ if (pSt); }

pdl commented 11 years ago

Would it work for p in boolean context to do p->validate($_)?

On second thoughts, this is probably a terrible idea, as it could get called inadvertently.