Skip to content

Commit 03a0f08

Browse files
committed
More
1 parent 5f3123c commit 03a0f08

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

test/rdoc/end_to_end/heading_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_headings
1818
===== Section 2.1.1.1.1
1919
====== Section 2.1.1.1.1.1
2020
MARKUP
21-
Helper.run_rdoc(__method__, markup) do |html_lines|
21+
Helper.run_rdoc(markup, __method__) do |html_lines|
2222
heading_lines = Helper.select_lines(html_lines, /^<h\d/)
2323
# Check count of headings.
2424
markup_lines = markup.lines

test/rdoc/end_to_end/helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@
66

77
class Helper
88

9+
# Create temporary directory.
910
def self.setup(filestem)
1011
@dirpath = File.join(Dir.tmpdir, 'MarkupTest-' + filestem)
1112
FileUtils.rm_rf(@dirpath)
1213
Dir.mkdir(@dirpath)
1314
end
1415

16+
# Remove temporary directory.
1517
def self.teardown
1618
FileUtils.rm_rf(@dirpath)
1719
end
1820

21+
# Convenience method for selecting lines.
1922
def self.select_lines(lines, pattern)
2023
lines.select { |line| line.match(pattern) }
2124
end
2225

23-
def self.run_rdoc(method, markup)
26+
# Run rdoc for given markup; method is used in setup.
27+
def self.run_rdoc(markup, method)
2428

2529
filestem = method.to_s
2630
self.setup(filestem)

test/rdoc/end_to_end/horizontal_rule_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ def test_horizontal_rule
1414
---
1515
1616
MARKUP
17-
Helper.run_rdoc(__method__, markup) do |html_lines|
17+
Helper.run_rdoc(markup, __method__) do |html_lines|
1818
# Check count of horizontal rules.
1919
hr_lines = Helper.select_lines(html_lines, '<hr>')
2020
assert_equal(2, hr_lines.size)
2121
# Check count of not horizontal rules.
22-
# One of the above generates an M dash, the other an N dash.
22+
# One of the above generates an M-dash, the other an N-dash.
2323
pattern = /<p>(—|–) Not a horizontal rule.<\/p>/
2424
not_hr_lines = html_lines.select {|line| line.match(pattern) }
2525
assert_equal(2, not_hr_lines.size)

test/rdoc/end_to_end/text_markup_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_italic
3434
= Heading containing <em>italic phrase</em>.
3535
3636
MARKUP
37-
Helper.run_rdoc(__method__, markup) do |html_lines|
37+
Helper.run_rdoc(markup, __method__) do |html_lines|
3838
italic_word_lines = Helper.select_lines(html_lines, '<em>italic_word</em>')
3939
# Check count of italic words.
4040
# (Five, not four, b/c the heading generates two.)
@@ -68,7 +68,7 @@ def test_bold
6868
= Heading containing <b>bold phrase</b>.
6969
7070
MARKUP
71-
Helper.run_rdoc(__method__, markup) do |html_lines|
71+
Helper.run_rdoc(markup, __method__) do |html_lines|
7272
# Check count of bold words.
7373
bold_word_lines = Helper.select_lines(html_lines, '<strong>bold_word</strong>')
7474
# (Five, not four, b/c the heading generates two.)
@@ -111,7 +111,7 @@ def test_monofont
111111
= Heading containing <code>monofont phrase</code>.
112112
113113
MARKUP
114-
Helper.run_rdoc(__method__, markup) do |html_lines|
114+
Helper.run_rdoc(markup, __method__) do |html_lines|
115115
monofont_word_lines = Helper.select_lines(html_lines, '<code>monofont_word</code>')
116116
# Check count of monofont words.
117117
# (Five, not four, b/c the heading generates two.)
@@ -138,7 +138,7 @@ def test_character_conversions
138138
= Heading containing #{convertible_characters}.
139139
140140
MARKUP
141-
Helper.run_rdoc(__method__, markup) do |html_lines|
141+
Helper.run_rdoc(markup, __method__) do |html_lines|
142142
converted_character_lines = Helper.select_lines(html_lines, '© ® … – — ‘foo’ “bar”')
143143
# Check count of converted character lines.
144144
# (The generated heading line contains escapes, and so does not match.)

0 commit comments

Comments
 (0)