3
require 'minitest/autorun'
5
require 'rdoc/code_objects'
7
class TestRDocContextSection < MiniTest::Unit::TestCase
10
@S = RDoc::Context::Section
11
@s = @S.new nil, 'section', '# comment'
15
assert_equal 'section', @s.aref
17
assert_equal '5Buntitled-5D', @S.new(nil, nil, nil).aref
19
assert_equal 'one+two', @S.new(nil, 'one two', nil).aref
22
def test_comment_equals
23
@s.comment = "# :section: section\n"
25
assert_equal "# comment", @s.comment
27
@s.comment = "# :section: section\n# other"
29
assert_equal "# comment\n# ---\n# other", @s.comment
31
s = @S.new nil, nil, nil
33
s.comment = "# :section:\n# other"
35
assert_equal "# other", s.comment
38
def test_extract_comment
39
assert_equal '', @s.extract_comment('')
40
assert_equal '', @s.extract_comment("# :section: b\n")
41
assert_equal '# c', @s.extract_comment("# :section: b\n# c")
42
assert_equal '# c', @s.extract_comment("# a\n# :section: b\n# c")
46
_, err = capture_io do
47
assert_match(/\ASEC\d{5}\Z/, @s.sequence)
50
assert_equal "#{@S}#sequence is deprecated, use #aref\n", err