File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11require 'fileutils'
2- require 'rexml/document'
32require_relative '../xref_test_case'
43
5- include REXML
6-
74class Helper
85
96 # Create temporary directory.
You can’t perform that action at this time.
0 commit comments