[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ARGV is set to nil in ruby 1.8.5 when using test/unit

Gunnar Gauslaa Bergem

9/5/2006 2:47:00 PM

Could anyone please explain what is going on here? Our test/unit scripts
suddenly stopped working properly when upgrading to 1.8.5 from 1.8.4.

Example script:
require 'test/unit'

class TestArgv < Test::Unit::TestCase

def test_argv
puts "test_argv: #{ARGV[0]}"
puts ARGV[0].nil?
end
end


Running on 1.8.4:

$ ruby -v
ruby 1.8.4 (2005-12-24) [i386-freebsd4]

$ ruby test_argv.rb randomarg
Loaded suite test_argv
Started
test_argv: randomarg
false
1 Answer

Michal Suchanek

9/6/2006 11:10:00 AM

0

Hello

You should put -- in front of your args. The args before the -- go to
Test::Unit.

It looks like the unknown args are consumed in 1.8.5 but left intact in 1.8.4.

Prefixing with -- works the same in both.

Thanks

Michal