in reply to Re^2: Test::Class & self-shunt pattern
in thread Documenting Methods/Subs

Hook::LexWrap is very cool certainly. I'd not thought of using it for hammering tests into tightly coupled code, but now you mention it, it's a bloody good idea.
Method selecters are cool, and interfaces would be yet another solution.
I happen to know there's someone working on method selectors in Perl 5. And, despite having written the Perl 6 RFC calling for Interface support, I'm becoming less and less convinced by them. Again, in a self shunt context, if you declare that a test case implements the 'foo' interface then you're obliged to implement all the methods in the 'foo' signature if you want the thing to compile, which can be somewhat painful, especially when you're adding the nth interface to your test class.
  • Comment on Re: Re: Re: Test::Class & self-shunt pattern

Replies are listed 'Best First'.
Re^4: Test::Class & self-shunt pattern
by adrianh (Chancellor) on Jan 13, 2003 at 12:09 UTC

    Hook::LexWrap is very cool certainly. I'd not thought of using it for hammering tests into tightly coupled code, but now you mention it, it's a bloody good idea.

    I love Hook::LexWrap. It allows you to do so many evil things :-)

    despite having written the Perl 6 RFC calling for Interface support, I'm becoming less and less convinced by them

    I'm not too fond of interfaces either. I think they're the wrong solution to the problems of C++'s multiple inheritance implementation.

    However, couldn't you just generate the missing methods at compile time (assuming there is some kind of introspection on your classes interfaces)?

      However, couldn't you just generate the missing methods at compile time (assuming there is some kind of introspection on your classes interfaces)?
      In theory, yes. But that's still going to be adding more complexity to your testing code that isn't directly related to the job of making sure the stuff under test behaves as expected. Sure you can hide it away in a superclass, but it will slow you down. And getting it right is likely to be complicated enough that you're going to have to write tests for your tests to make sure that interfaces are getting stubbed out with sensible methods.