On 3/2/06, John Maclean <info / jayeola.org> wrote:
> My script _works_ but testrb is giving me some error messages. I've just come across unit testing yestarday so I'm quite new to this. What do these error messages mean and why does the script not run?
>
>
> A sample script:-
>
> jayeola@acid$ cat fact.rb
> def fact(n)
>   return 1 if n == 0
>   f = 1
>   n.downto(1) do |i|
>     f *= i
>   end
>   return f
> end
> print fact(ARGV[0].to_i), "\n"
>
> sample usage:-
> jayeola@acid$ ruby fact.rb 44
> 2658271574788448768043625811014615890319638528000000000
>
> using testrb:-
>
> jayeola@acid$ testrb ruby fact.rb 4
> /usr/lib/ruby/1.8/test/unit/collector/dir.rb:83:in `require': no such
> file to load -- ruby (LoadError)

It can't find a file to load named "ruby".
Try running "testrb fact.rb 4".

> from /usr/lib/ruby/1.8/test/unit/collector/dir.rb:83:in `collect_file'
> from /usr/lib/ruby/1.8/test/unit/collector/dir.rb:70:in
> `recursive_collect'
> from /usr/lib/ruby/1.8/test/unit/collector/dir.rb:30:in `collect'
> from /usr/lib/ruby/1.8/test/unit/collector/dir.rb:29:in `collect'
> from /usr/lib/ruby/1.8/test/unit/autorunner.rb:67
> from /usr/lib/ruby/1.8/test/unit/autorunner.rb:198:in `run'
> from /usr/bin/testrb:5

--
R. Mark Volkmann
Partner, Object Computing, Inc.