summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2017-06-18 22:43:22 -0600
committerDan Allen <dan.j.allen@gmail.com>2017-06-18 22:43:22 -0600
commit4496fa093fa9b8686edcf32e357ef32cb4fafa68 (patch)
tree8eb62c7cdc7e6fdcdeae7fcad8c9cb178471653a /test
parent6983820d6c9144ba8d88f572960cc72f4e96f9e2 (diff)
add test to verify lineno of empty section at end of input is accurate
Diffstat (limited to 'test')
-rw-r--r--test/document_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/document_test.rb b/test/document_test.rb
index fa2aff01..f272a354 100644
--- a/test/document_test.rb
+++ b/test/document_test.rb
@@ -361,6 +361,21 @@ idseparator=-')
assert_equal 1, section_1.lineno
end
+ test 'should assign correct source location if section occurs on last line of input' do
+ input = <<-EOS
+= Document Title
+
+== Section A
+
+content
+
+== Section B
+ EOS
+
+ doc = document_from_string input, :sourcemap => true
+ assert_equal [1, 3, 7], (doc.find_by :context => :section).map(&:lineno)
+ end
+
test 'should allow sourcemap option on document to be modified' do
doc = Asciidoctor.load_file fixture_path('sample.asciidoc'), :parse => false
doc.sourcemap = true