From: Chris Carter Date: 2007-07-14T23:23:25+09:00 Subject: Re: weirdness with ruby unit testing on mac On 7/14/07, David Carlton wrote: > I have a ruby project that I've written in a Linux environment. (Ruby > 1.8.5, on Ubuntu.) I'd like to work on it on my Mac (Ruby 1.8.2, OSX > 10.4) while I'm on vacation, and something weird is happening with my > tests. > > The project lives in a directory 'dbcdb' of my $RUBYLIB; there's a > subdirectory 'test', with a file 'all.rb' containing lines like this: > > require 'dbcdb/test/test_author_printer' > require 'dbcdb/test/test_author_writer' > require 'dbcdb/test/test_book_writer' > > Each of those test files defines a suite. > > On the Linux box, if I do > > ruby -e "require 'dbcdb/test/all'" > > it runs all of them: > > panini$ ruby -e "require 'dbcdb/test/all'" > Loaded suite -e > Started > ...................................................................................................... > Finished in 0.083742 seconds. > > 102 tests, 384 assertions, 0 failures, 0 errors > > On the Mac, though, it does this: > > truffle:~ carlton$ ruby -e "require 'dbcdb/test/all'" > Loaded suite . > Started > > Finished in 0.000213 seconds. > > 0 tests, 0 assertions, 0 failures, 0 errors > > If I try to run one of the test files, it claims to run some tests: > > truffle:~ carlton$ ruby -e "require 'dbcdb/test/test_author_printer'" > Loaded suite . > Started > .................................................................................................... > Finished in 0.040504 seconds. > > 100 tests, 383 assertions, 0 failures, 0 errors > > but that's equally bizarre since test_author_printer doesn't contain > 100 tests. > > What's going on here? Is there some difference between 1.8.2 and > 1.8.5 that I'm unaware of, or something weird about the Mac ruby > installation, or what? If it's not something well-known, what's the > best way to debug the problem? > > Thanks, > David Carlton > carlton@bactrian.org > > First of all, you should be doing: ruby dbcdb/test/all.rb Not your wacky thing with -e and require. Dunno if that will fix it, but it is standard practice this way. -- Chris Carter concentrationstudios.com brynmawrcs.com