Skip to content

Commit

Permalink
Added tests for the convert_verse() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhradilek committed Nov 12, 2024
1 parent a8fb91c commit 704ecb0
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/test_verse.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'minitest/autorun'
require_relative 'helper'

class VerseTest < Minitest::Test
def test_explicit_verse
xml = <<~EOF.chomp.to_dita
[verse]
First line
Second line
EOF

assert_xpath_equal xml, "First line\nSecond line", '//lines/text()'
end

def test_delimited_verse
xml = <<~EOF.chomp.to_dita
[verse]
____
First line
Second line
____
EOF

assert_xpath_equal xml, "First line\n\nSecond line", '//lines/text()'
end

def test_verse_author
xml = <<~EOF.chomp.to_dita
[verse,Author Name]
Verse line
EOF

assert_xpath_equal xml, "Verse line\n&#8212; Author Name", '//lines/text()'
end

def test_verse_source
xml = <<~EOF.chomp.to_dita
[verse,,Citation source]
Verse line
EOF

assert_xpath_equal xml, 'Verse line', '//lines/text()'
assert_xpath_equal xml, 'Citation source', '//lines/cite/text()'
end
end

0 comments on commit 704ecb0

Please sign in to comment.