I\'m trying to include the unit tests for a module in the same source file as the module itself, following the Perl modulino model.
#! /usr/bin/env ruby
req
Just found one way to prevent the unit test from being executed when the module is required from a script. There is a flag in unit.rb in .../lib/ruby/1.8/test/ to set to true.
Combined with samg trick (thanks again), we can write:
if (__FILE__ != $0)
Test::Unit.run = true ### do not run the unit tests
end