[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: assertions in Ruby
From:       "MikkelFJ" <mikkelfj-anti-spam () bigfoot ! com>
Date:       2002-10-04 16:08:13
[Download RAW message or body]


"Bulat Ziganshin" <bulatz@integ.ru> wrote in message
news:159343050360.20021004175427@integ.ru...
> Hello Mark,
>
> Friday, October 04, 2002, 5:43:46 PM, you wrote:
>
> VM> Is anyone aware of a Ruby module that adds support for assertions such
as
> VM> what is supported in Java 1.4?  I wrote such a thing yesterday and am
> VM> considering releasing it if I'm not duplicating what someone else has
> VM> already done.
>
> are you know about RubyUnit and concept of unit testing? it is another
> way to checking program correctness

I think native assertions in Ruby would be great. I certainly could use
something like that.

The idea would be that the Ruby interpreter normally ignores assertions like
comments, but that you can run Ruby with assetions enabled. In this way you
can add time consuming assertions inside the code.
I also think assertions work well with Unit Testing because the Unit Test
would catch assertion exceptions and report the location of failure.
I redefine the assert macro in C/C++ to do something similar and so does
CPPUnit.

Unit tests are fine, but assertions also document code and can catch many
errors unit testing won't because they systematically verify pre-conditions
and post-conditions for all the test cases.

Mikkel




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic