File: tc_docbasedocumentpool.rb

package info (click to toggle)
dhelp 0.6.32
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 604 kB
  • sloc: ruby: 1,171; sh: 555; perl: 372; makefile: 77
file content (36 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'test/unit'
require 'dhelp'
require 'set'

class TC_DocBaseDocumentPool < Test::Unit::TestCase
  def doc_base_document(path)
    Dhelp::DocBaseDocument.new("test/doc-base-pool/#{path}")
  end

  def setup
    @pool = Dhelp::DocBaseDocumentPool.new(:dirs => ['test/doc-base-pool'])
    @doc_base_id_set = Set.new(['docbook-xsl-doc-html',
                                'pica-manual',
                                'pica-manual-2'])
  end

  def test_each
    doc_id_set = Set.new
    @pool.each do |doc|
      doc_id_set << doc.document
    end
    assert_equal @doc_base_id_set, Set.new(doc_id_set)
  end

  def test_section
    sections = []
    @pool.each_section do |s, docs|
      sections << s
    end
    assert_equal ['Apps/Text', 'Admin'], sections
  end

  def teardown
    @pool = nil
  end
end