1
1
# frozen_string_literal: true
2
2
require_relative 'helper'
3
3
4
- class TestRDocGeneratorDarkfish < RDoc ::TestCase
4
+ class RDocGeneratorDarkfishTest < RDoc ::TestCase
5
5
6
6
def setup
7
7
super
@@ -348,7 +348,7 @@ def test_meta_tags_for_classes
348
348
)
349
349
end
350
350
351
- def test_meta_tags_for_pages
351
+ def test_meta_tags_for_rdoc_files
352
352
top_level = @store . add_file ( "CONTRIBUTING.rdoc" , parser : RDoc ::Parser ::Simple )
353
353
top_level . comment = <<~RDOC
354
354
= Contributing
@@ -367,6 +367,52 @@ def test_meta_tags_for_pages
367
367
)
368
368
end
369
369
370
+ def test_meta_tags_for_markdown_files
371
+ top_level = @store . add_file ( "MyPage.md" , parser : RDoc ::Parser ::Markdown )
372
+ top_level . comment = <<~MARKDOWN
373
+ # MyPage
374
+
375
+ This is a comment
376
+ MARKDOWN
377
+
378
+ @g . generate
379
+
380
+ content = File . binread ( "MyPage_md.html" )
381
+ assert_include ( content , '<meta name="keywords" content="ruby,documentation,MyPage">' )
382
+ assert_include (
383
+ content ,
384
+ '<meta name="description" content="MyPage: # MyPage This is a comment">' ,
385
+ )
386
+ end
387
+
388
+ def test_meta_tags_for_raw_pages
389
+ top_level = @store . add_file ( "MyPage" , parser : RDoc ::Parser ::Simple )
390
+ top_level . comment = RDoc ::Markup ::Document . new ( RDoc ::Markup ::Paragraph . new ( 'this is a comment' ) )
391
+
392
+ @g . generate
393
+
394
+ content = File . binread ( "MyPage.html" )
395
+ assert_include ( content , '<meta name="keywords" content="ruby,documentation,MyPage">' )
396
+ assert_include (
397
+ content ,
398
+ '<meta name="description" content="MyPage: this is a comment ">' ,
399
+ )
400
+ end
401
+
402
+ def test_meta_tags_for_empty_document
403
+ top_level = @store . add_file ( "MyPage" , parser : RDoc ::Parser ::Simple )
404
+ top_level . comment = RDoc ::Markup ::Document . new
405
+
406
+ @g . generate
407
+
408
+ content = File . binread ( "MyPage.html" )
409
+ assert_include ( content , '<meta name="keywords" content="ruby,documentation,MyPage">' )
410
+ assert_include (
411
+ content ,
412
+ '<meta name="description" content="MyPage: ">' ,
413
+ )
414
+ end
415
+
370
416
##
371
417
# Asserts that +filename+ has a link count greater than 1 if hard links to
372
418
# @tmpdir are supported.
0 commit comments