~ubuntu-branches/ubuntu/saucy/dhelp/saucy-proposed

« back to all changes in this revision

Viewing changes to test/tc_dhelptitledbase.rb

  • Committer: Bazaar Package Importer
  • Author(s): Esteban Manchado Velázquez
  • Date: 2007-10-20 17:35:26 UTC
  • Revision ID: james.westby@ubuntu.com-20071020173526-q1ekqfek5tlctsn1
Tags: 0.5.25
* Maintainer change.
* Rewrite dhelp_parse in Ruby. This fixes some bugs and avoids many problems
  (Closes: #21678, #268487, #62454, #312950, #442943, #444429, #193428).
* This release should be a drop-in replacement for the C version, and still
  uses the same database and internal format.
* It also adds a Ruby library, to allow other developers to write other
  programs that read and/or update the dhelp databases.
* Use "http://localhost" for CGI script URLs (Closes: #114588).
* Removed misleading dot from example (Closes: #381804).
* Uses sensible-browser instead of having its own configuration system
  (Closes: #146002, #162518, #381805, #217162, #430590).
* Clean up the HTML a bit (Closes: #438973, #134567, #115306).
* Remove references to obsolete script dh_dhelp (Closes: #369459).
* Raise title limit from 49 to 100 characters (Closes: #102393).
* Depend on doc-base, to make sure packages have their documentation
  available for dhelp (Closes: #314733, #368035).
* Wait a couple of seconds before exiting, after a fatal error, to make sure
  the user can read the error message (Closes: #35097).
* Make documentation index files world-readable, regardless of current umask
  (Closes: #158792, #430474, #430505).
* Remove obsolete script dhelp2dwww.pl, and references to it
  (Closes: #364245).
* Remove "dangerous" environment variables from dsearch, to avoid taint
  problems (Closes: #389944).
* Strip blanks from .dhelp field values (Closes: #133218).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'test/unit'
 
2
require 'dhelp'
 
3
require 'fileutils'
 
4
 
 
5
class TC_DhelpTitleDB < Test::Unit::TestCase
 
6
   TMP_DIR = 'test/tmp'
 
7
 
 
8
   def setup
 
9
      FileUtils.rm_r TMP_DIR if File.exists? TMP_DIR
 
10
      FileUtils.mkdir_p TMP_DIR
 
11
      @db = Dhelp::TitleDatabase.open(BDB::CREATE|BDB::TRUNCATE, {}, 0644,
 
12
                                 File.join(TMP_DIR, 'dhelptitlebase'))
 
13
   end
 
14
 
 
15
   def test_insert
 
16
      fooItem = Dhelp::ItemData.new(:dir     => 'foodir',
 
17
                                    :dtitle => 'Title for foodir')
 
18
      barItem = Dhelp::ItemData.new(:dir     => 'bardir',
 
19
                                    :dtitle => 'Title for bardir')
 
20
      @db.write(fooItem)
 
21
      @db.write(barItem)
 
22
      assert_equal(2, @db.size,              "Number of keys")
 
23
   end
 
24
 
 
25
   def teardown
 
26
      @db.close
 
27
      FileUtils.rm_rf TMP_DIR
 
28
   end
 
29
end