-
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_quote() method.
- Loading branch information
Showing
1 changed file
with
52 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,52 @@ | ||
require 'minitest/autorun' | ||
require_relative 'helper' | ||
|
||
class QuoteTest < Minitest::Test | ||
def test_explicit_quote | ||
xml = <<~EOF.chomp.to_dita | ||
[quote,Author Name,Quote source] | ||
Quoted line | ||
EOF | ||
|
||
assert_xpath_equal xml, 'Quoted line', '//lq/p[1]/text()' | ||
assert_xpath_equal xml, '— Author Name', '//lq/p[2]/text()' | ||
assert_xpath_equal xml, 'Quote source', '//lq/cite/text()' | ||
end | ||
|
||
def test_delimited_quote | ||
xml = <<~EOF.chomp.to_dita | ||
[quote,Author Name,Quote source] | ||
____ | ||
First line | ||
Second line | ||
____ | ||
EOF | ||
|
||
assert_xpath_equal xml, 'First line', '//lq/p[1]/text()' | ||
assert_xpath_equal xml, 'Second line', '//lq/p[2]/text()' | ||
assert_xpath_equal xml, '— Author Name', '//lq/p[3]/text()' | ||
assert_xpath_equal xml, 'Quote source', '//lq/cite/text()' | ||
end | ||
|
||
def test_quoted_paragraph | ||
xml = <<~EOF.chomp.to_dita | ||
"Quoted line" | ||
-- Author Name, Quote source | ||
EOF | ||
|
||
assert_xpath_equal xml, 'Quoted line', '//lq/p[1]/text()' | ||
assert_xpath_equal xml, '— Author Name', '//lq/p[2]/text()' | ||
assert_xpath_equal xml, 'Quote source', '//lq/cite/text()' | ||
end | ||
|
||
def test_quote_title | ||
xml = <<~EOF.chomp.to_dita | ||
.Quote title | ||
[quote,Author Name,Quote source] | ||
Quoted line | ||
EOF | ||
|
||
assert_xpath_equal xml, 'Quote title', '//lq/p[@outputclass="title"]/b/text()' | ||
end | ||
end |