test/test_index.rb in review-3.1.0 vs test/test_index.rb in review-3.2.0

- old
+ new

@@ -206,6 +206,46 @@ book = Book::Base.load chap = Book::Chapter.new(book, 1, '-', nil) index = Book::HeadlineIndex.parse(src, chap) assert_equal [1, 1, 1], index['sec1-1-1'].number end + + def test_headeline_index11 + src = <<-EOB += chap1 +==[nodisp] sec01 +==[notoc] sec02 +== sec1 +===[nodisp] sec1-0 +=== sec1-1 +==[nonum] sec03 +== sec04 + EOB + book = Book::Base.load + chap = Book::Chapter.new(book, 1, '-', nil) + index = Book::HeadlineIndex.parse(src, 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 + assert_equal nil, index['sec03'].number + assert_equal [2], index['sec04'].number + end + + def test_headeline_index12 + src = <<-EOB += chap1 +== A +=== A2 +==[nonum] B +=== B2 + EOB + book = Book::Base.load + chap = Book::Chapter.new(book, 1, '-', nil) + index = Book::HeadlineIndex.parse(src, 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 end