# In Ruby 1.9 Test::Unit::TestCase parse ARGV differently

**URL:** <https://www.ruby-forum.com/t/in-ruby-1-9-test-testcase-parse-argv-differently/192290>\
**Category:** Ruby\
**Created:** [July 27, 2010, 8:13pm UTC](https://www.ruby-forum.com/t/in-ruby-1-9-test-testcase-parse-argv-differently/192290 "2010-07-27T20:13:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliver-peng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@oliver-peng](https://www.ruby-forum.com/u/oliver-peng)\
**Post date:** [July 27, 2010, 8:13pm UTC](https://www.ruby-forum.com/t/in-ruby-1-9-test-testcase-parse-argv-differently/192290/1 "2010-07-27T20:13:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![oliver-peng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@oliver-peng](https://www.ruby-forum.com/u/oliver-peng)\
**Post date:** [July 27, 2010, 8:46pm UTC](https://www.ruby-forum.com/t/in-ruby-1-9-test-testcase-parse-argv-differently/192290/2 "2010-07-27T20:46:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![oliver-peng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@oliver-peng](https://www.ruby-forum.com/u/oliver-peng)\
**Post date:** [July 28, 2010, 3:09pm UTC](https://www.ruby-forum.com/t/in-ruby-1-9-test-testcase-parse-argv-differently/192290/3 "2010-07-28T15:09:43Z")

</div>

> 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
