mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
400afca88a
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
54 lines
1.1 KiB
Ruby
54 lines
1.1 KiB
Ruby
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
|
|
assert_match %r%^invalid options: --bogus%, err
|
|
end
|
|
|
|
def test_parse_ignore_invalid_default
|
|
out, err = capture_io do
|
|
@options.parse %w[--bogus --main BLAH]
|
|
end
|
|
|
|
refute_match %r%^Usage: %, err
|
|
assert_match %r%^invalid options: --bogus%, err
|
|
|
|
assert_equal 'BLAH', @options.main_page
|
|
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
|
|
|
|
def test_parse_main
|
|
out, err = capture_io do
|
|
@options.parse %w[--main MAIN]
|
|
end
|
|
|
|
assert_empty out
|
|
assert_empty err
|
|
|
|
assert_equal 'MAIN', @options.main_page
|
|
end
|
|
|
|
end
|
|
|