2010-04-01 03:45:16 -04:00
|
|
|
require 'rubygems'
|
|
|
|
require 'minitest/autorun'
|
|
|
|
require 'rdoc/options'
|
|
|
|
|
|
|
|
class TestRDocOptions < MiniTest::Unit::TestCase
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@options = RDoc::Options.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_parse_ignore_invalid
|
|
|
|
out, err = capture_io do
|
|
|
|
@options.parse %w[--ignore-invalid --bogus]
|
|
|
|
end
|
|
|
|
|
|
|
|
refute_match %r%^Usage: %, err
|
2010-04-20 23:10:03 -04:00
|
|
|
assert_match %r%^invalid options: --bogus%, err
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_parse_ignore_invalid_default
|
|
|
|
out, err = capture_io do
|
2010-04-20 23:10:03 -04:00
|
|
|
@options.parse %w[--bogus --main BLAH]
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
refute_match %r%^Usage: %, err
|
2010-04-20 23:10:03 -04:00
|
|
|
assert_match %r%^invalid options: --bogus%, err
|
|
|
|
|
|
|
|
assert_equal 'BLAH', @options.main_page
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_parse_ignore_invalid_no
|
|
|
|
out, err = capture_io do
|
|
|
|
assert_raises SystemExit do
|
|
|
|
@options.parse %w[--no-ignore-invalid --bogus]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_match %r%^Usage: %, err
|
|
|
|
assert_match %r%^invalid option: --bogus%, err
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|