nicoolas25/ruby_contracts — pull request #2 by jjttcc (2013-06-14 05:04:44+00:00)
Title: Added several tests for checking correctness of inherited contracts.

Nicolas - I've created a branch for a few tests I've added and am sending you this pull request for that branch. (I hope I'm doing this right - I've never done this before.) So assuming this works, I created these tests to test your latest changes with respect to inherited contracts. The tests expose 3 bugs:

- When a subclass redefines a method that has a precondition in the parent and does not add a precondition of its own, the parent's precondition is not checked on a subclass instance. (See file test/pre_tests/test1.rg - the last test in that file)

- When a subclass redefines a method with a precondition and adds a new precondition to the method, although a violation of this weaker precondition causes an exception (while no violation does not, as expected), the exception/error is not for a precondition violation:
"wrong number of arguments (0 for 3) (ArgumentError)". Your code might be detecting the violation but perhaps has a bug in the exception/error-reporting logic. (See test/pre_tests/test2.rb, with more explanation in comments at end.)

- A postcondition ("do |v, mininc| @value == v && @minimum_incr == mininc end") which is correct is reported as invalid. (See the files in test/postbug)

Let me know if you have any questions about this, or if there were any problems with this pull request, or etc.

Thanks.
Jim