Skip to content

Commit 575061f

Browse files
committed
Avoid using REXML
1 parent 03a0f08 commit 575061f

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

test/rdoc/end_to_end/heading_test.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@ def test_headings
2626
# Check each markup line against the corresponding heading line.
2727
markup_lines.each_with_index do |markup_line, index|
2828
heading_line = heading_lines[index]
29-
doc = Document.new(heading_line)
30-
root_ele = doc.root
31-
# Check number of equal signs against the heading level.
32-
equal_signs, section_title = markup_line.chomp.split(' ', 2)
33-
heading_level = equal_signs.size
34-
assert_equal("h#{heading_level}", root_ele.name)
35-
# Check the id attribute.
36-
id_value = root_ele.attribute('id').value
37-
assert_equal("label-#{section_title.gsub(' ', '+')}", id_value)
29+
equal_signs, expected_title = markup_line.chomp.split(' ', 2)
30+
assert(heading_line.include?(expected_title))
31+
expected_heading_level = equal_signs.size
32+
heading_line.match(/^<h(\d)/)
33+
actual_heading_level = $1.to_i
34+
assert_equal(expected_heading_level, actual_heading_level)
3835
end
3936
end
4037
end

test/rdoc/end_to_end/helper.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
require 'fileutils'
2-
require 'rexml/document'
32
require_relative '../xref_test_case'
43

5-
include REXML
6-
74
class Helper
85

96
# Create temporary directory.

0 commit comments

Comments
 (0)