File: test.rb

package info (click to toggle)
libeb-ruby 2.3-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 140 kB
  • ctags: 128
  • sloc: ansic: 1,338; ruby: 110; makefile: 41
file content (51 lines) | stat: -rw-r--r-- 926 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/env ruby -Ke
require "eb"

if $KCODE!="EUC" then
  raise RuntimeError,"lib eb requires EUC coding system"
end

b=EB::Book.new

WORD1=""
WORD2=""

print "\n****** Initial Test\n"
b.bind("/cdrom")
p b.disktype
p b.bound?
p b.path
p b.charcode
p b.subbook_count
p b.subbook_list

print "\n****** Sub Books\n"
0.upto(b.subbook_count-1) do |i|
  print "===============\n"
  p b.title(i), b.directory(i)
end

print "\n****** Sub Book Test\n"

b.subbook=0
p b.subbook

p b.search_available?
p b.exactsearch_available?
p b.endsearch_available?

print "\n****** Search Test\n"
items=b.exactsearch( WORD1 )
print "Hit :", items.size,"\n"
items.each do |item|
  print "====================\n"
  print "==   ",item[0],"\n"
  print "\n",item[1],"\n"
end

b.exactsearch( WORD2 ) do |item|
  print "====================\n"
  print "==   ",item[0],"\n"
  print "\n",item[1],"\n"
#  EB::Cancel   # yield will be stopped
end