Assertions in Ruby

Yes, I’m aware of RubyUnit. I love it and use it extensively! However, I
think there is a place for assertions too. Assertions provide useful
documentation inside the code as opposed to be being in a separate file as I
believe most unit tests are implemented. My examples demonstrated another
potential use of assertions which is to provide a weak form of type checking
… which of course has been a controversial issue on the mailing list in
the past few weeks.

···

-----Original Message-----
From: Bulat Ziganshin [mailto:bulatz@integ.ru]
Sent: Friday, October 04, 2002 8:55 AM
To: ruby-talk@ruby-lang.org
Subject: Re: assertions in Ruby

Hello Mark,

Friday, October 04, 2002, 5:43:46 PM, you wrote:

Is anyone aware of a Ruby module that adds support for
assertions such as
what is supported in Java 1.4? I wrote such a thing
yesterday and am
considering releasing it if I’m not duplicating what
someone else has
already done.

are you know about RubyUnit and concept of unit testing? it is another
way to checking program correctness


WARNING: All e-mail sent to and from this address will be received or
otherwise recorded by the A.G. Edwards corporate e-mail system and is
subject to archival, monitoring or review by, and/or disclosure to,
someone other than the recipient.


Volkmann, Mark wrote:

Yes, I’m aware of RubyUnit. I love it and use it extensively! However,
I think there is a place for assertions too. Assertions provide useful
documentation inside the code as opposed to be being in a separate file
as I believe most unit tests are implemented. My examples demonstrated
another potential use of assertions which is to provide a weak form of
type checking … which of course has been a controversial issue on the
mailing list in the past few weeks.

http://www.pragmaticprogrammer.com/ruby/downloads/dbc.html

It’s an implementation of Design By Contract for Ruby put together (I
believe) by Andy Hunt. And although it should be viewed mostly as a
prototype, it is directly usable and may inspire you to grow it into
something greater.

···


Jason Voegele
“We believe that we invent symbols. The truth is that they invent us.”
– Gene Wolfe, The Book of the New Sun