Sha256: 2c52dde90b8466d52098fd4c3bb4a70b681963797a228cde14e69087df07dbb7

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

require 'test_helper'
require 'review/book'
require 'review/book/index'

class IndexTest < Test::Unit::TestCase
  include ReVIEW
  def test_footnote_index
    fn = Book::FootnoteIndex.parse(['//footnote[foo][bar]'])
    items = fn.to_a
    item = items[0]
    assert_equal 'foo', item.id
    assert_equal 'bar', item.content
  end
  def test_footnote_index_with_escape
    fn = Book::FootnoteIndex.parse(['//footnote[foo][bar[\]buz]'])
    items = fn.to_a
    item = items[0]
    assert_equal 'foo', item.id
    assert_equal 'bar[]buz', item.content
  end
  def test_footnote_index_with_escape2
    fn = Book::FootnoteIndex.parse(['//footnote[foo][bar\\a\\$buz]'])
    items = fn.to_a
    item = items[0]
    assert_equal 'foo', item.id
    assert_equal 'bar\\a\\$buz', item.content
  end

  def test_HeadelineIndex
    src = <<-EOB
= chap1
== sec1-1
== sec1-2
=== sec1-2-1
===[column] column1
==== inside_column
===[/column]
===[column] column2
=== sec1-2-2
== sec1-3
==== sec1-3-0-1
    EOB
    chap = Book::Chapter.new(nil, 1, '-', nil) # dummy
    index = Book::HeadlineIndex.parse(src, 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
review-1.4.0 test/test_index.rb