test/test_index.rb in review-4.0.0 vs test/test_index.rb in review-4.1.0
- old
+ new
@@ -52,11 +52,11 @@
== sec1-3
==== sec1-3-0-1
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [2, 2], index['sec1-2|sec1-2-2'].number
assert_equal '1.2.2', index.number('sec1-2|sec1-2-2')
end
def test_headeline_index2
@@ -69,11 +69,11 @@
== sec1-3
=== sec1-3-1
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines, chap)
assert_equal [3, 1], index['sec1-3|sec1-3-1'].number
assert_equal '1.3.1', index.number('sec1-3|sec1-3-1')
end
def test_headeline_index3
@@ -87,11 +87,11 @@
== sec1-3
=== sec1-3-1
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [2, 2], index['sec1-2|sec1-2-2'].number
assert_equal '1.2.2', index.number('sec1-2|sec1-2-2')
assert_equal [3, 1], index['sec1-3|sec1-3-1'].number
assert_equal '1.3.1', index.number('sec1-3|sec1-3-1')
@@ -106,11 +106,11 @@
=== sec1-2-1
=== sec1-2-2
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [2, 2], index['sec1-2|sec1-2-2'].number
assert_equal '1.2.2', index.number('sec1-2|sec1-2-2')
end
def test_headeline_index5
@@ -122,11 +122,11 @@
=== sec1-2-1
=== sec1-2-2
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [2, 2], index['sec1-2-2'].number
assert_equal '1.2.2', index.number('sec1-2-2')
end
def test_headeline_index6
@@ -137,11 +137,11 @@
== sec2
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [1, 1], index['target'].number
assert_equal '1.1.1', index.number('target')
end
def test_headeline_index7
@@ -155,11 +155,11 @@
^-- real target but it cannot be detected, because there is another one.
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil) # dummy
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_raise ReVIEW::KeyError do
assert_equal [1, 1], index['target'].number
end
end
@@ -172,11 +172,11 @@
==== sec1-1-1
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil)
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal '1.1.1', index.number('sec1-1')
end
def test_headeline_index9
src = <<-EOB
@@ -188,11 +188,11 @@
==== sec1-1-1
=== sec1-2
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil)
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [1, 1, 1], index['sec1-1-1'].number
end
def test_headeline_index10
src = <<-EOB
@@ -203,11 +203,11 @@
==== sec1-1-1
=== sec1-2
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil)
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [1, 1, 1], index['sec1-1-1'].number
end
def test_headeline_index11
src = <<-EOB
@@ -220,11 +220,11 @@
==[nonum] sec03
== sec04
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil)
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal nil, index['sec01'].number
assert_equal nil, index['sec02'].number
assert_equal [1], index['sec1'].number
assert_equal nil, index['sec1-0'].number
assert_equal [1, 1], index['sec1-1'].number
@@ -240,10 +240,10 @@
==[nonum] B
=== B2
EOB
book = Book::Base.load
chap = Book::Chapter.new(book, 1, '-', nil)
- index = Book::HeadlineIndex.parse(src, chap)
+ index = Book::HeadlineIndex.parse(src.lines.to_a, chap)
assert_equal [1], index['A'].number
assert_equal [1, 1], index['A2'].number
assert_equal nil, index['B'].number
assert_equal [1, 2], index['B2'].number
end