@@ -95,37 +95,17 @@ def test_try_require_returns_false_for_missing_gem
9595 end
9696
9797 # --- rdoc.rb formatter constructor compatibility -----------------------
98+ # Only the tests matching the installed RDoc are defined; CI runs both.
9899
99- def test_rdoc_4_through_7_receive_options
100- formatter = Class . new do
101- def initialize ( options )
102- raise ArgumentError , "expected RDoc::Options" unless options . is_a? ( ::RDoc ::Options )
103- end
104-
105- def convert ( content ) ; "rendered:#{ content } " ; end
106- end
107-
108- [ "4.0.0" , "6.3.4.1" , "7.2.0" ] . each do |version |
109- with_stub_const ( "RDoc::VERSION" , version ) do
110- with_stub_const ( "RDoc::Markup::ToHtml" , formatter ) do
111- assert_equal "rendered:hello" , GitHub ::Markup ::RDoc . new . render ( "README.rdoc" , "hello" )
112- end
113- end
100+ if ::RDoc ::VERSION . to_i >= 8
101+ def test_rdoc_8_formatter_rejects_positional_options
102+ assert_raises ( ArgumentError ) { ::RDoc ::Markup ::ToHtml . new ( ::RDoc ::Options . new ) }
103+ assert_includes GitHub ::Markup ::RDoc . new . render ( "README.rdoc" , "*bold*" ) , "<strong>bold</strong>"
114104 end
115- end
116-
117- def test_rdoc_8_and_legacy_versions_receive_no_positional_options
118- formatter = Class . new do
119- def initialize ; end
120- def convert ( content ) ; "rendered:#{ content } " ; end
121- end
122-
123- [ "3.6.1" , "8.0.0" , "8.1.0" ] . each do |version |
124- with_stub_const ( "RDoc::VERSION" , version ) do
125- with_stub_const ( "RDoc::Markup::ToHtml" , formatter ) do
126- assert_equal "rendered:hello" , GitHub ::Markup ::RDoc . new . render ( "README.rdoc" , "hello" )
127- end
128- end
105+ else
106+ def test_rdoc_7_formatter_requires_positional_options
107+ assert_raises ( ArgumentError ) { ::RDoc ::Markup ::ToHtml . new }
108+ assert_includes GitHub ::Markup ::RDoc . new . render ( "README.rdoc" , "*bold*" ) , "<strong>bold</strong>"
129109 end
130110 end
131111
0 commit comments