[ANN] Test::Unit 0.1.6

If you don’t know what Test::Unit is, I’ve included an explanation
further down. For everyone else, here’s info about this release:

ChangeLog:

  • Changed #set_up to #setup in the examples (thanks to Daniel Berger
    for finding my omission).
  • !Changed #tear_down to #teardown to make it grammatically (and
    visually) consistent with #setup.

Notes:

  • Now that the teardown naming issue has been taken care of, this
    version will move in to 1.8 unless I hear about any major problems with
    it. Pound away!

Known Issues:

  • Installation is still broken for most OS X users. See ruby-talk:59722
    for one possible solution, and the surrounding thread for other thoughts
    on the problem.

README:
Unit testing is making waves all over the place, largely due to the fact
that it is a core practice of XP. While XP is great, unit testing has
been around for a long time and has always been a good idea. One of the
keys to good unit testing, though, is not just writing tests, but having
tests. What’s the difference? Well, if you just write a test and throw
it away, you have no guarantee that something won’t change later which
breaks your code. If, on the other hand, you have tests (obviously you
have to write them first), and run them as often as possible, you slowly
build up a wall of things that cannot break without you immediately
knowing about it. This is when unit testing hits its peak usefulness.

Enter Test::Unit, a framework for unit testing in Ruby, helping you to
design, debug and evaluate your code by making it easy to write and have
tests for it.

Grab the fun at http://testunit.talbott.ws/.

Happy testing,

Nathaniel

<:((><

···

RoleModel Software, Inc.
EQUIP VI

It doesn’t seem to have made it into 1.8.0 preview. Pity! What is
happening on that front?

There also seems to be depreciated things in Test::Unit 0.1.6 when run
under Ruby 1.8.0-preview

test/unit/util/observable.rb:18: warning: Object#id will be deprecated; use Object#object_id

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

Good Ideas:
Ruby - http://www.ruby-lang-org - The best of perl,python,scheme without the pain.
Valgrind - Valgrind Home - memory debugger for x86-GNU/Linux
Free your books - http://www.bookcrossing.com
Memtest86 - http://www.memtest86.com - Free standalone, excellent memory tester for PC’s.

···

On Sun, 29 Dec 2002 nathaniel@NOSPAMtalbott.ws wrote:

  • Now that the teardown naming issue has been taken care of, this
    version will move in to 1.8 unless I hear about any major problems with
    it. Pound away!

John Carter said:

It doesn’t seem to have made it into 1.8.0 preview. Pity! What is
happening on that front?

Well, it wasn’t ready for the preview… the mail you quoted was sent
after the preview was released on 12/24.

I’m still planning on moving it in to CVS HEAD RSN; I just haven’t gotten
around to it yet.

There also seems to be depreciated things in Test::Unit 0.1.6 when run
under Ruby 1.8.0-preview

test/unit/util/observable.rb:18: warning: Object#id will be deprecated;
use Object#object_id

Yup, I just noticed these last night. Unfortunately, Object#object_id
doesn’t even exist in the 1.6 line (at least not 1.6.7), so I’m trying to
figure out what to do. I don’t really want to maintain two Test::Unit
codebases, but that may be the only way to get around it.

Nathaniel

“Nathaniel Talbott” nathaniel@NOSPAMtalbott.ws writes:

test/unit/util/observable.rb:18: warning: Object#id will be deprecated;
use Object#object_id

Yup, I just noticed these last night. Unfortunately,
Object#object_id doesn’t even exist in the 1.6 line (at least not
1.6.7), so I’m trying to figure out what to do. I don’t really want
to maintain two Test::Unit codebases, but that may be the only way
to get around it.

There is always Object#id

Here is another one for you I have just found.

Running a unit test with
ruby -d
I get…

Exception `NameError’ at
/usr/local/ruby-1.8.0/lib/ruby/site_ruby/1.8/test/unit.rb:164 -
uninitialized constant DEBUGGER__
/usr/local/ruby-1.8.0/lib/ruby/site_ruby/1.8/test/unit.rb:164:
uninitialized constant DEBUGGER__ (NameError)
from /usr/local/ruby-1.8.0/lib/ruby/site_ruby/1.8/test/unit.rb:162

Which comes from this line in unit.rb
# We can’t debug tests run with at_exit unless we add the
following:
set_trace_func DEBUGGER__.context.method(:trace_func).to_proc if $DEBUG

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

Good Ideas:
Ruby - http://www.ruby-lang.org - The best of perl,python,scheme without the pain.
Valgrind - Valgrind Home - memory debugger for x86-GNU/Linux
Free your books - http://www.bookcrossing.com
Memtest86 - http://www.memtest86.com - Free standalone, excellent memory tester for PC’s.

···

On Wed, 15 Jan 2003, Nathaniel Talbott wrote:

Yup, I just noticed these last night. Unfortunately, Object#object_id
doesn’t even exist in the 1.6 line (at least not 1.6.7), so I’m trying to
figure out what to do. I don’t really want to maintain two Test::Unit
codebases, but that may be the only way to get around it.

Matt Armstrong said:

“Nathaniel Talbott” nathaniel@NOSPAMtalbott.ws writes:

test/unit/util/observable.rb:18: warning: Object#id will be
deprecated; use Object#object_id

Yup, I just noticed these last night. Unfortunately,
Object#object_id doesn’t even exist in the 1.6 line (at least not
1.6.7), so I’m trying to figure out what to do. I don’t really want to
maintain two Test::Unit codebases, but that may be the only way to get
around it.

There is always Object#id

Ahh, I had forgotten about that - thanks for the pointer. My laptop is in
for service at the moment, so I can’t readily check, but I’m assuming that
is valid (and warningless, if that’s even a word) under 1.6 as well as
1.7/1.8, right?

Nathaniel

John Carter said:

Here is another one for you I have just found.

Running a unit test with
ruby -d
I get…

Exception `NameError’ at
/usr/local/ruby-1.8.0/lib/ruby/site_ruby/1.8/test/unit.rb:164 -
uninitialized constant DEBUGGER__
/usr/local/ruby-1.8.0/lib/ruby/site_ruby/1.8/test/unit.rb:164:
uninitialized constant DEBUGGER__ (NameError)
from /usr/local/ruby-1.8.0/lib/ruby/site_ruby/1.8/test/unit.rb:162

Which comes from this line in unit.rb

We can’t debug tests run with at_exit unless we add the

following:
set_trace_func DEBUGGER__.context.method(:trace_func).to_proc if $DEBUG

Youch! I’ll check that out as soon as I get my machine back from the
service depot. Thanks for pointing it out.

Nathaniel

“Nathaniel Talbott” nathaniel@NOSPAMtalbott.ws writes:

Matt Armstrong said:

There is always Object#id

Ahh, I had forgotten about that - thanks for the pointer. My laptop is in
for service at the moment, so I can’t readily check, but I’m assuming that
is valid (and warningless, if that’s even a word) under 1.6 as well as
1.7/1.8, right?

Yes. I think it is present in ruby 1.4 as well (if you’re into that).
:slight_smile: