summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2013-01-09 01:02:20 -0700
committerDan Allen <dan.j.allen@gmail.com>2013-01-09 01:02:20 -0700
commitce8a08026732244620ca759d3e2edd0a06fccb35 (patch)
tree800d53016ff91dfd99f00cd6ecefdb054a2654fc /test
parente1a0e81bcaf11c450429a938e46afaeec6d7fd7b (diff)
implement passthrough block
- add passthrough block - rename regex for lit_blk to literal for dynamic assignment of context - add resolve_subs() option for resolving subs for user-supplied list - tests for passthrough block and passthrough substitutions
Diffstat (limited to 'test')
-rw-r--r--test/blocks_test.rb46
-rw-r--r--test/document_test.rb4
2 files changed, 48 insertions, 2 deletions
diff --git a/test/blocks_test.rb b/test/blocks_test.rb
index 6a1460ea..6d28dd74 100644
--- a/test/blocks_test.rb
+++ b/test/blocks_test.rb
@@ -151,6 +151,52 @@ ____
end
end
+ context 'Passthrough Blocks' do
+ test 'can parse a passthrough block' do
+ input = <<-EOS
+++++
+This is a passthrough block.
+++++
+ EOS
+
+ block = block_from_string input
+ assert !block.nil?
+ assert_equal 1, block.buffer.size
+ assert_equal 'This is a passthrough block.', block.buffer.first
+ end
+
+ test 'performs passthrough subs on a passthrough block' do
+ input = <<-EOS
+:type: passthrough
+
+++++
+This is a '{type}' block.
+http://asciidoc.org
+++++
+ EOS
+
+ expected = %(This is a 'passthrough' block.\n<a href="http://asciidoc.org">http://asciidoc.org</a>\n)
+ output = render_embedded_string input
+ assert_equal expected, output
+ end
+
+ test 'passthrough block honors explicit subs list' do
+ input = <<-EOS
+:type: passthrough
+
+[subs="attributes, quotes"]
+++++
+This is a '{type}' block.
+http://asciidoc.org
+++++
+ EOS
+
+ expected = %(This is a <em>passthrough</em> block.\nhttp://asciidoc.org\n)
+ output = render_embedded_string input
+ assert_equal expected, output
+ end
+ end
+
context "Images" do
test "can render block image with alt text" do
input = <<-EOS
diff --git a/test/document_test.rb b/test/document_test.rb
index ecd33b22..729f905b 100644
--- a/test/document_test.rb
+++ b/test/document_test.rb
@@ -24,7 +24,7 @@ context 'Document' do
assert !renderer.nil?
views = renderer.views
assert !views.nil?
- assert_equal 24, views.size
+ assert_equal 25, views.size
assert views.has_key? 'document'
assert views['document'].is_a?(Asciidoctor::HTML5::DocumentTemplate)
end
@@ -39,7 +39,7 @@ context 'Document' do
assert !renderer.nil?
views = renderer.views
assert !views.nil?
- assert_equal 24, views.size
+ assert_equal 25, views.size
assert views.has_key? 'document'
assert views['document'].is_a?(Asciidoctor::DocBook45::DocumentTemplate)
end