reimplement tests and minor fixes.
This commit is contained in:
parent
3542837d7f
commit
5b390b2083
7
Rakefile
7
Rakefile
|
@ -1,2 +1,9 @@
|
|||
require "bundler/gem_tasks"
|
||||
task :default => :spec
|
||||
|
||||
require 'rake/testtask'
|
||||
Rake::TestTask.new :test do |test|
|
||||
test.libs << 'lib' << 'test'
|
||||
test.pattern = 'test/**/test_*.rb'
|
||||
test.verbose = true
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require 'rubygems'
|
||||
require 'bundler'
|
||||
|
||||
begin
|
||||
Bundler.setup(:default, :development)
|
||||
rescue Bundler::BundlerError => e
|
||||
|
@ -7,6 +8,7 @@ rescue Bundler::BundlerError => e
|
|||
$stderr.puts "Run `bundle install` to install missing gems"
|
||||
exit e.status_code
|
||||
end
|
||||
|
||||
require 'test/unit'
|
||||
require 'shoulda'
|
||||
|
||||
|
@ -14,9 +16,6 @@ require 'timeout'
|
|||
require 'benchmark'
|
||||
require 'ffi/libc'
|
||||
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
||||
|
||||
require 'timeout_interrupt'
|
||||
|
||||
class Test::Unit::TestCase
|
||||
|
|
|
@ -4,7 +4,7 @@ class TestRubyTimeoutInterrupt < Test::Unit::TestCase
|
|||
def blocking
|
||||
t = FFI::LibC.fopen '/dev/ptmx', 'r'
|
||||
b = FFI::LibC.malloc 1025
|
||||
s = FFI::LibC.fread b, 1, 1024, t
|
||||
FFI::LibC.fread b, 1, 1024, t
|
||||
ensure
|
||||
FFI::LibC.fclose t if t
|
||||
FFI::LibC.free b if b
|
||||
|
@ -114,7 +114,7 @@ class TestRubyTimeoutInterrupt < Test::Unit::TestCase
|
|||
called = false
|
||||
prepared.call do
|
||||
assert_raise TimeoutInterrupt::Error, 'It should time out after one second, but it did not.' do
|
||||
prepared.call { 2; sleep 2 }
|
||||
prepared.call { _ = 2; sleep 2 }
|
||||
end
|
||||
called = true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue