Rick_Tan
(Rick Tan)
1
How do I get to the command line arguments in test/unit. In the
following class definition, ARGV is showing empty
class RunitTest < Test::Unit::TestCase
def setup
.
<-- I like to parse the command line arguments here or somewhere
before
the code in test_runit are executed.
.
end
def test_runit
end
end
Thanks in advance
···
--
Posted via http://www.ruby-forum.com/.
Does this help?
$ cat /tmp/trial.rb
require 'test/unit'
$my_argv = ARGV.dup
class MyTest < Test::Unit::TestCase
def setup
p $my_argv
end
def test_dummy; end
end
$ ruby /tmp/trial.rb foo bar qux
Loaded suite /tmp/trial
Started
["foo", "bar", "qux"]
.
Finished in 0.00097 seconds.
1 tests, 0 assertions, 0 failures, 0 errors
···
--
Alex
--
Posted via http://www.ruby-forum.com/.
Rick_Tan
(Rick Tan)
3
Yes, it does.
Thanks a lot
-Rick
Alex Young wrote in post #989065:
···
Does this help?
$ cat /tmp/trial.rb
require 'test/unit'
$my_argv = ARGV.dup
class MyTest < Test::Unit::TestCase
def setup
p $my_argv
end
def test_dummy; end
end
$ ruby /tmp/trial.rb foo bar qux
Loaded suite /tmp/trial
Started
["foo", "bar", "qux"]
.
Finished in 0.00097 seconds.
1 tests, 0 assertions, 0 failures, 0 errors
--
Alex
--
Posted via http://www.ruby-forum.com/\.