-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for the convert_verse() method.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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— 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 |