Best Minitest_ruby code snippet using Test.start
formatter_test_case.rb
Source:formatter_test_case.rb
...73 # Call to add the visitor tests to your test case74 def self.add_visitor_tests75 self.class_eval do76 ##77 # Calls start_accepting which needs to verify startup state78 def test_start_accepting79 @to.start_accepting80 start_accepting81 end82 ##83 # Calls end_accepting on your test case which needs to call84 # <tt>@to.end_accepting</tt> and verify document generation85 def test_end_accepting86 @to.start_accepting87 @to.res << 'hi'88 end_accepting89 end90 ##91 # Calls accept_blank_line92 def test_accept_blank_line93 @to.start_accepting94 @to.accept_blank_line @RM::BlankLine.new95 accept_blank_line96 end97 ##98 # Test case that calls <tt>@to.accept_document</tt>99 def test_accept_document100 @to.start_accepting101 @to.accept_document @RM::Document.new @RM::Paragraph.new 'hello'102 accept_document103 end104 ##105 # Calls accept_heading with a level 5 RDoc::Markup::Heading106 def test_accept_heading107 @to.start_accepting108 @to.accept_heading @RM::Heading.new(5, 'Hello')109 accept_heading110 end111 ##112 # Calls accept_heading_1 with a level 1 RDoc::Markup::Heading113 def test_accept_heading_1114 @to.start_accepting115 @to.accept_heading @RM::Heading.new(1, 'Hello')116 accept_heading_1117 end118 ##119 # Calls accept_heading_2 with a level 2 RDoc::Markup::Heading120 def test_accept_heading_2121 @to.start_accepting122 @to.accept_heading @RM::Heading.new(2, 'Hello')123 accept_heading_2124 end125 ##126 # Calls accept_heading_3 with a level 3 RDoc::Markup::Heading127 def test_accept_heading_3128 # HACK this doesn't belong here129 skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars130 @to.start_accepting131 @to.accept_heading @RM::Heading.new(3, 'Hello')132 accept_heading_3133 end134 ##135 # Calls accept_heading_4 with a level 4 RDoc::Markup::Heading136 def test_accept_heading_4137 @to.start_accepting138 @to.accept_heading @RM::Heading.new(4, 'Hello')139 accept_heading_4140 end141 ##142 # Calls accept_heading_b with a bold level 1 RDoc::Markup::Heading143 def test_accept_heading_b144 @to.start_accepting145 @to.accept_heading @RM::Heading.new(1, '*Hello*')146 accept_heading_b147 end148 ##149 # Calls accept_heading_suppressed_crossref with a level 1150 # RDoc::Markup::Heading containing a suppressed crossref151 def test_accept_heading_suppressed_crossref # HACK to_html_crossref test152 @to.start_accepting153 @to.accept_heading @RM::Heading.new(1, '\\Hello')154 accept_heading_suppressed_crossref155 end156 ##157 # Calls accept_paragraph158 def test_accept_paragraph159 @to.start_accepting160 @to.accept_paragraph @RM::Paragraph.new('hi')161 accept_paragraph162 end163 ##164 # Calls accept_paragraph_b with a RDoc::Markup::Paragraph containing165 # bold words166 def test_accept_paragraph_b167 @to.start_accepting168 @to.accept_paragraph @RM::Paragraph.new('reg <b>bold words</b> reg')169 accept_paragraph_b170 end171 ##172 # Calls accept_paragraph_i with a RDoc::Markup::Paragraph containing173 # emphasized words174 def test_accept_paragraph_i175 @to.start_accepting176 @to.accept_paragraph @RM::Paragraph.new('reg <em>italic words</em> reg')177 accept_paragraph_i178 end179 ##180 # Calls accept_paragraph_plus with a RDoc::Markup::Paragraph containing181 # teletype words182 def test_accept_paragraph_plus183 @to.start_accepting184 @to.accept_paragraph @RM::Paragraph.new('reg +teletype+ reg')185 accept_paragraph_plus186 end187 ##188 # Calls accept_paragraph_star with a RDoc::Markup::Paragraph containing189 # bold words190 def test_accept_paragraph_star191 @to.start_accepting192 @to.accept_paragraph @RM::Paragraph.new('reg *bold* reg')193 accept_paragraph_star194 end195 ##196 # Calls accept_paragraph_underscore with a RDoc::Markup::Paragraph197 # containing emphasized words198 def test_accept_paragraph_underscore199 @to.start_accepting200 @to.accept_paragraph @RM::Paragraph.new('reg _italic_ reg')201 accept_paragraph_underscore202 end203 ##204 # Calls accept_verbatim with a RDoc::Markup::Verbatim205 def test_accept_verbatim206 @to.start_accepting207 @to.accept_verbatim @RM::Verbatim.new("hi\n", " world\n")208 accept_verbatim209 end210 ##211 # Calls accept_raw with a RDoc::Markup::Raw212 def test_accept_raw213 @to.start_accepting214 @to.accept_raw @RM::Raw.new("<table>",215 "<tr><th>Name<th>Count",216 "<tr><td>a<td>1",217 "<tr><td>b<td>2",218 "</table>")219 accept_raw220 end221 ##222 # Calls accept_rule with a RDoc::Markup::Rule223 def test_accept_rule224 @to.start_accepting225 @to.accept_rule @RM::Rule.new(4)226 accept_rule227 end228 ##229 # Calls accept_list_item_start_bullet230 def test_accept_list_item_start_bullet231 @to.start_accepting232 @to.accept_list_start @bullet_list233 @to.accept_list_item_start @bullet_list.items.first234 accept_list_item_start_bullet235 end236 ##237 # Calls accept_list_item_start_label238 def test_accept_list_item_start_label239 @to.start_accepting240 @to.accept_list_start @label_list241 @to.accept_list_item_start @label_list.items.first242 accept_list_item_start_label243 end244 ##245 # Calls accept_list_item_start_lalpha246 def test_accept_list_item_start_lalpha247 @to.start_accepting248 @to.accept_list_start @lalpha_list249 @to.accept_list_item_start @lalpha_list.items.first250 accept_list_item_start_lalpha251 end252 ##253 # Calls accept_list_item_start_note254 def test_accept_list_item_start_note255 @to.start_accepting256 @to.accept_list_start @note_list257 @to.accept_list_item_start @note_list.items.first258 accept_list_item_start_note259 end260 ##261 # Calls accept_list_item_start_note_2262 def test_accept_list_item_start_note_2263 list = @RM::List.new(:NOTE,264 @RM::ListItem.new('<tt>teletype</tt>',265 @RM::Paragraph.new('teletype description')))266 @to.start_accepting267 list.accept @to268 @to.end_accepting269 accept_list_item_start_note_2270 end271 ##272 # Calls accept_list_item_start_number273 def test_accept_list_item_start_number274 @to.start_accepting275 @to.accept_list_start @number_list276 @to.accept_list_item_start @number_list.items.first277 accept_list_item_start_number278 end279 ##280 # Calls accept_list_item_start_ualpha281 def test_accept_list_item_start_ualpha282 @to.start_accepting283 @to.accept_list_start @ualpha_list284 @to.accept_list_item_start @ualpha_list.items.first285 accept_list_item_start_ualpha286 end287 ##288 # Calls accept_list_item_end_bullet289 def test_accept_list_item_end_bullet290 @to.start_accepting291 @to.accept_list_start @bullet_list292 @to.accept_list_item_start @bullet_list.items.first293 @to.accept_list_item_end @bullet_list.items.first294 accept_list_item_end_bullet295 end296 ##297 # Calls accept_list_item_end_label298 def test_accept_list_item_end_label299 @to.start_accepting300 @to.accept_list_start @label_list301 @to.accept_list_item_start @label_list.items.first302 @to.accept_list_item_end @label_list.items.first303 accept_list_item_end_label304 end305 ##306 # Calls accept_list_item_end_lalpha307 def test_accept_list_item_end_lalpha308 @to.start_accepting309 @to.accept_list_start @lalpha_list310 @to.accept_list_item_start @lalpha_list.items.first311 @to.accept_list_item_end @lalpha_list.items.first312 accept_list_item_end_lalpha313 end314 ##315 # Calls accept_list_item_end_note316 def test_accept_list_item_end_note317 @to.start_accepting318 @to.accept_list_start @note_list319 @to.accept_list_item_start @note_list.items.first320 @to.accept_list_item_end @note_list.items.first321 accept_list_item_end_note322 end323 ##324 # Calls accept_list_item_end_number325 def test_accept_list_item_end_number326 @to.start_accepting327 @to.accept_list_start @number_list328 @to.accept_list_item_start @number_list.items.first329 @to.accept_list_item_end @number_list.items.first330 accept_list_item_end_number331 end332 ##333 # Calls accept_list_item_end_ualpha334 def test_accept_list_item_end_ualpha335 @to.start_accepting336 @to.accept_list_start @ualpha_list337 @to.accept_list_item_start @ualpha_list.items.first338 @to.accept_list_item_end @ualpha_list.items.first339 accept_list_item_end_ualpha340 end341 ##342 # Calls accept_list_start_bullet343 def test_accept_list_start_bullet344 @to.start_accepting345 @to.accept_list_start @bullet_list346 accept_list_start_bullet347 end348 ##349 # Calls accept_list_start_label350 def test_accept_list_start_label351 @to.start_accepting352 @to.accept_list_start @label_list353 accept_list_start_label354 end355 ##356 # Calls accept_list_start_lalpha357 def test_accept_list_start_lalpha358 @to.start_accepting359 @to.accept_list_start @lalpha_list360 accept_list_start_lalpha361 end362 ##363 # Calls accept_list_start_note364 def test_accept_list_start_note365 @to.start_accepting366 @to.accept_list_start @note_list367 accept_list_start_note368 end369 ##370 # Calls accept_list_start_number371 def test_accept_list_start_number372 @to.start_accepting373 @to.accept_list_start @number_list374 accept_list_start_number375 end376 ##377 # Calls accept_list_start_ualpha378 def test_accept_list_start_ualpha379 @to.start_accepting380 @to.accept_list_start @ualpha_list381 accept_list_start_ualpha382 end383 ##384 # Calls accept_list_end_bullet385 def test_accept_list_end_bullet386 @to.start_accepting387 @to.accept_list_start @bullet_list388 @to.accept_list_end @bullet_list389 accept_list_end_bullet390 end391 ##392 # Calls accept_list_end_label393 def test_accept_list_end_label394 @to.start_accepting395 @to.accept_list_start @label_list396 @to.accept_list_end @label_list397 accept_list_end_label398 end399 ##400 # Calls accept_list_end_lalpha401 def test_accept_list_end_lalpha402 @to.start_accepting403 @to.accept_list_start @lalpha_list404 @to.accept_list_end @lalpha_list405 accept_list_end_lalpha406 end407 ##408 # Calls accept_list_end_number409 def test_accept_list_end_number410 @to.start_accepting411 @to.accept_list_start @number_list412 @to.accept_list_end @number_list413 accept_list_end_number414 end415 ##416 # Calls accept_list_end_note417 def test_accept_list_end_note418 @to.start_accepting419 @to.accept_list_start @note_list420 @to.accept_list_end @note_list421 accept_list_end_note422 end423 ##424 # Calls accept_list_end_ulpha425 def test_accept_list_end_ualpha426 @to.start_accepting427 @to.accept_list_start @ualpha_list428 @to.accept_list_end @ualpha_list429 accept_list_end_ualpha430 end431 ##432 # Calls list_nested with a two-level list433 def test_list_nested434 doc = @RM::Document.new(435 @RM::List.new(:BULLET,436 @RM::ListItem.new(nil,437 @RM::Paragraph.new('l1'),438 @RM::List.new(:BULLET,439 @RM::ListItem.new(nil,440 @RM::Paragraph.new('l1.1')))),441 @RM::ListItem.new(nil,...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!