summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dallen@redhat.com>2013-04-17 03:41:42 -0600
committerDan Allen <dallen@redhat.com>2013-04-17 03:58:34 -0600
commitba194b968d891762fc656e3a9ee6c3aaa171e2b6 (patch)
tree9958e76b1310f35450a136e3eb258c090de81443 /test
parent7d6942c7752d2515af00dda267f1ce2a8873cf77 (diff)
resolves #226 add line selection to include macro
- support selecting individual lines, line ranges & remainder
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/include-file.asciidoc9
-rw-r--r--test/reader_test.rb14
2 files changed, 22 insertions, 1 deletions
diff --git a/test/fixtures/include-file.asciidoc b/test/fixtures/include-file.asciidoc
index 21ed5fbd..61db9538 100644
--- a/test/fixtures/include-file.asciidoc
+++ b/test/fixtures/include-file.asciidoc
@@ -1 +1,8 @@
-included content
+first line of included content
+second line of included content
+third line of included content
+fourth line of included content
+fifth line of included content
+sixth line of included content
+seventh line of included content
+eighth line of included content
diff --git a/test/reader_test.rb b/test/reader_test.rb
index b7670553..28ee5955 100644
--- a/test/reader_test.rb
+++ b/test/reader_test.rb
@@ -173,6 +173,20 @@ include::fixtures/include-file.asciidoc[]
assert_match(/included content/, output)
end
+ test 'include macro supports line selection' do
+ input = <<-EOS
+include::fixtures/include-file.asciidoc[lines=1;3..4;6..-1]
+ EOS
+
+ output = render_string input, :safe => Asciidoctor::SafeMode::SAFE, :header_footer => false, :attributes => {'docdir' => File.dirname(__FILE__)}
+ assert_match(/first line/, output)
+ assert_match(/third line/, output)
+ assert_match(/fourth line/, output)
+ assert_match(/sixth line/, output)
+ assert_match(/seventh line/, output)
+ assert_match(/eighth line/, output)
+ end
+
test "block is called to handle an include macro" do
input = <<-EOS
first line