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
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
Yes, it does.
Thanks a lot
-Rick
Alex Y. 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