File: thread_test.rb

package info (click to toggle)
ruby-zoom 0.4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 296 kB
  • ctags: 99
  • sloc: ansic: 680; xml: 262; ruby: 254; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 640 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class SearchTest < Test::Unit::TestCase
  # Jason Ronallo, 2007-09-20
  # With libyaz3 3.0.12 threading fails for gem at 
  # point of retrieving a record out of a result set.
  # libyaz3 3.0.10 worked fine.
  # Update: 3.0.14 fixes the problem.

  def test_thread
    thread = Thread.new do
      ZOOM::Connection.open('z3950.loc.gov', 7090) do |conn|
        conn.database_name = 'Voyager'
        conn.preferred_record_syntax = 'USMARC'
        result_set = conn.search('nature')
        array = result_set[0, 6] #change the 2nd number
        assert_equal 6, array.length #change the number
      end
    end
    thread.join
  end

end