O
Oliver Peng
After upgrading to Ruby 1.9, I found that class Test::Unit::TestCase
parse ARGV parameters in different way. Here is the sample code:
require 'test/unit'
class Test_Main < Test::Unit::TestCase
def test1
puts "ARGV[0] = %s" % ARGV[0]
puts "ARGV[1] = %s" % ARGV[1]
puts "ARGV[2] = %s" % ARGV[2]
end
end
On Ruby 1.8:
ruby ./test.rb -- a b c
Loaded suite ./test
Started
ARGV[0] = a
ARGV[1] = b
ARGV[2] = c
On Ruby 1.9:
ruby ./test.rb -- a b c
Loaded suite ./test
Started
ARGV[0] = --
ARGV[1] = a
ARGV[2] = b
Can anyone explain what happened and what is the best way to work around
this?
Thanks.
parse ARGV parameters in different way. Here is the sample code:
require 'test/unit'
class Test_Main < Test::Unit::TestCase
def test1
puts "ARGV[0] = %s" % ARGV[0]
puts "ARGV[1] = %s" % ARGV[1]
puts "ARGV[2] = %s" % ARGV[2]
end
end
On Ruby 1.8:
ruby ./test.rb -- a b c
Loaded suite ./test
Started
ARGV[0] = a
ARGV[1] = b
ARGV[2] = c
On Ruby 1.9:
ruby ./test.rb -- a b c
Loaded suite ./test
Started
ARGV[0] = --
ARGV[1] = a
ARGV[2] = b
Can anyone explain what happened and what is the best way to work around
this?
Thanks.