From: Oliver Peng on 27 Jul 2010 14:17 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. -- Posted via http://www.ruby-forum.com/.
From: Oliver Peng on 27 Jul 2010 14:46 Find the reason. In Ruby 1.9, it uses new Unit Test framework MiniTest::Unit to replace Test::Unit. They also added a compatibility layer to MiniTest. But it looks that it doesn't work well because parsing parameter is such an important logic for calling test code and now it is not compatible. It is impossible for me to change tons of Make file to be compatible with new Unit Test framework and finally I have installed test-unit gem to get the original Test::Unit framework back. -- Posted via http://www.ruby-forum.com/.
From: Roger Pack on 28 Jul 2010 09:12 > 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? File a bug with minitest? -r -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Where can I find the 'shebang' line? Next: Which Ruby is in use? |