Welcome to the Monastery | |
PerlMonks |
Re^3: RFC: Test::Contract - extensible object-oriented runtime check seriesby tobyink (Canon) |
on May 08, 2017 at 13:27 UTC ( [id://1189796]=note: print w/replies, xml ) | Need Help?? |
I guess I'm not really sure what your use case is. If your code is mostly object-oriented, you can take advantage of type constraints in any of the major OO frameworks. That automatically covers you for object constructors and accessors. Then if you want to check the parameters passed to method calls and function calls, you can re-use the same type constraint checking, courtesy of things like Type::Params. For example, if you want to check that your add function has been passed two numbers:
If you want to check that certain variables are sane within your function, not just the parameters that are passed as input, then you can still do this with type constraints:
Though frankly, if you keep your function definitions short and simple, this is rarely necessary. Then you just come down to a handful of sanity checks that go beyond what type constraints would normally do.
I don't see what the point of adding a big Test::Builder-like framework on top of this would be. What can it cover which the above cannot?
In Section
Meditations
|
|