-
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_example() 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 ExampleTest < Minitest::Test | ||
def test_explicit_example_block | ||
xml = <<~EOF.chomp.to_dita | ||
[example] | ||
An example block | ||
EOF | ||
|
||
assert_xpath_equal xml, 'An example block', '//example/text()' | ||
end | ||
|
||
def test_delimited_example_block | ||
xml = <<~EOF.chomp.to_dita | ||
==== | ||
An example block | ||
==== | ||
EOF | ||
|
||
assert_xpath_equal xml, 'An example block', '//example/p/text()' | ||
end | ||
|
||
def test_example_block_id | ||
xml = <<~EOF.chomp.to_dita | ||
[#example-id] | ||
==== | ||
An example block | ||
==== | ||
EOF | ||
|
||
assert_xpath_equal xml, 'example-id', '//example/@id' | ||
end | ||
|
||
def test_example_block_title | ||
xml = <<~EOF.chomp.to_dita | ||
.An example block title | ||
==== | ||
An example block | ||
==== | ||
EOF | ||
|
||
assert_xpath_equal xml, 'An example block title', '//example/title/text()' | ||
assert_xpath_equal xml, 'An example block', '//example/p/text()' | ||
end | ||
end |