From 89c26cdaf25463c891a8ce915fefa1a181b3ac64 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 27 Feb 2011 11:40:40 +0000 Subject: fix warnings and enable them for tests Cleaner code anyways. --- lib/posix_mq.rb | 6 +++--- test/test_posix_mq.rb | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/posix_mq.rb b/lib/posix_mq.rb index a059cf8..0048c26 100644 --- a/lib/posix_mq.rb +++ b/lib/posix_mq.rb @@ -51,16 +51,16 @@ class POSIX_MQ block.arity == 1 or raise ArgumentError, "arity of notify block must be 1" r, w = IO.pipe - self.notify_exec(w, Thread.new(r, w, self) do |r, w, mq| + self.notify_exec(w, Thread.new(block) do |blk| begin begin r.read(1) or raise Errno::EINTR rescue Errno::EINTR, Errno::EAGAIN retry end - block.call(mq) + blk.call(self) ensure - mq.notify_cleanup + notify_cleanup r.close rescue nil w.close rescue nil end diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb index af8e6ba..ec9ba03 100644 --- a/test/test_posix_mq.rb +++ b/test/test_posix_mq.rb @@ -1,6 +1,5 @@ # -*- encoding: binary -*- require 'test/unit' -require 'posix_mq' require 'thread' require 'fcntl' $stderr.sync = $stdout.sync = true @@ -9,6 +8,8 @@ begin require "dl/func" rescue LoadError end +$-w = true +require 'posix_mq' class Test_POSIX_MQ < Test::Unit::TestCase @@ -402,7 +403,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase end if POSIX_MQ.method_defined?(:notify) def test_bad_open_mode - assert_raises(ArgumentError) { mq = POSIX_MQ.new(@path, "rw") } + assert_raises(ArgumentError) { POSIX_MQ.new(@path, "rw") } end def test_bad_open_attr -- cgit v1.2.3-24-ge0c7