[Rock-dev] [rock] #161: pocolog: stream aligner has a by-one error

Sylvain Joyeux sylvain.joyeux at dfki.de
Thu May 3 13:03:52 CEST 2012


On 05/03/2012 12:18 PM, Leif Christensen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Let me guess: the test suite had an off-by-one error? ;-)
Actually, it was more subtle than that.

#assert in Ruby test cases takes two arguments: the boolean and an error 
message if the assertion fails

Ruby 1.8 implementation of test/unit did not check whether the message 
provided was a string or something like it. Which led too often to

   assert expected_value, value

which always passes if expected_value is neither false nor nil, i.e. 
always passes in practice.

Ruby 1.9 does raise if the second argument of #assert is not a string

Sylvain


More information about the Rock-dev mailing list