From: John Maclean Date: 2008-04-13T22:54:18+09:00 Subject: Basics to test Unit =begin Can the Test unit be used to test methods or variables in other files? I've come across this reference, (http://clarkware.com/cgi/blosxom/2005/03/18), which seems to test snipets of code within the test itself. The idea is to test that the array x is not empty nd use the Test Unit to do it. =end # foo.rb x = `df`.grep(/^\/dev/).sort # in order of dev name # test_foo.rb require 'test/unit' require '/path/to/foo.rb' # test that the df cmd exists on the system that we are running it on # output of cmd is put in array. this array should NOT be !!--empty--!! class TESTX < Test::Unit::TestCase def test_no_df assert(x.empty?, "df command not found") end end - jjm