summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2017-06-20 21:43:31 -0600
committerGitHub <noreply@github.com>2017-06-20 21:43:31 -0600
commit10f6b096d545e1294f99d4fde2b9d6bbee75d3ec (patch)
tree229e963a77c3b5cac1103a7f8ba45bc9e8151ca4 /test
parent740944900c433f6e70d2f623f3ebb2b2d1299164 (diff)
resolves #1729 add support for include tags in languages with only circumfix comments (#2199)
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/include-file.ml3
-rw-r--r--test/reader_test.rb20
2 files changed, 15 insertions, 8 deletions
diff --git a/test/fixtures/include-file.ml b/test/fixtures/include-file.ml
new file mode 100644
index 00000000..c687c763
--- /dev/null
+++ b/test/fixtures/include-file.ml
@@ -0,0 +1,3 @@
+(* tag::snippet[] *)
+let s = SS.empty;;
+(* end::snippet[] *)
diff --git a/test/reader_test.rb b/test/reader_test.rb
index f97b5974..fd68f720 100644
--- a/test/reader_test.rb
+++ b/test/reader_test.rb
@@ -763,20 +763,24 @@ include::fixtures/include-file.asciidoc[tags=snippetA;snippetB]
refute_match(/included content/, output)
end
- test 'include directive supports tagged selection in XML file' do
- input = <<-EOS
+ test 'include directive supports tagged selection in language that uses circumfix comments' do
+ {
+ 'include-file.xml' => '<snippet>content</snippet>',
+ 'include-file.ml' => 'let s = SS.empty;;'
+ }.each do |filename, expect|
+ input = <<-EOS
[source,xml,indent=0]
----
-include::fixtures/include-file.xml[tag=snippet]
+include::fixtures/#{filename}[tag=snippet]
----
- EOS
+ EOS
- output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME
- assert_match('&lt;snippet&gt;content&lt;/snippet&gt;', output)
- refute_match('root', output)
+ doc = document_from_string input, :safe => :safe, :base_dir => DIRNAME
+ assert_equal expect, doc.blocks[0].source
+ end
end
- test 'include directive does not select tagged lines inside tagged selection' do
+ test 'include directive does not select lines with tag directives inside tagged selection' do
input = <<-EOS
++++
include::fixtures/include-file.asciidoc[tags=snippet]