You’ve writen some code and it works. You now begin to think of the
future and how it might scale/grow/bloat. You think that it’s a good
time to introduce Test::Unit into the mix. You write a test to ensure
that a library has been required. You check this test by adding a
/dummy/ library that does /not/ exist and the test shows no errors.
How to test that a script has loaded library foo?
=begin
How to test that a script has loaded library foo?
=end
require ‘test/unit’
require ‘/path/to/code.rb’
test to check that library has been required.
class PathNameHiddenTest < Test::Unit::TestCase
def test_libraries
message = “library not loaded”
assert $".grep(/foo.rb/)
end
end
–
John M.
07739 171 531
MSc (DIC)
Timezone: GMT