in reply to When I use "can"

Here's my, rather short, list.

I'll occassionally use can in a unit test, to verify that an object implements an interface (where "verify" is as close as one can get in a language that doesn't support first-class interfaces). Using can reduces the need to litter classes with predicates that are only there for purposes of testing.

Replies are listed 'Best First'.
Re: Re: When I use "can"
by hardburn (Abbot) on Apr 06, 2004 at 21:18 UTC

    I never cared for this style of testing. Just call the blasted method and if the test script dies it's not there.

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated