sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [sleepy.penguin] [PATCH] tests: switch to minitest
@ 2013-10-19  7:27 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2013-10-19  7:27 UTC (permalink / raw)
  To: sleepy.penguin

Add a compatibility shim in test/helper to avoid noisy warnings with
Minitest (out-of-the-box on Ruby 2.0.0) and also Minitest 5.

Automated conversion via:
  perl -i -p -e 's,test/unit,./test/helper,g' test/test_*.rb
  perl -i -p -e 's,Test::Unit::TestCase,Testcase,g' test/test_*.rb

Yes, I prefer Perl for one-liners :P
---
 Oops, I pushed this out w/o reasoning.  Using minitest since
 it's available in Ruby 2.0 and less confusing given the incompatible
 Test::Unit 2.0

 test/helper.rb                   | 8 ++++++++
 test/test_constants.rb           | 4 ++--
 test/test_epoll.rb               | 4 ++--
 test/test_epoll_gc.rb            | 4 ++--
 test/test_epoll_io.rb            | 4 ++--
 test/test_epoll_optimizations.rb | 4 ++--
 test/test_eventfd.rb             | 4 ++--
 test/test_inotify.rb             | 4 ++--
 test/test_kqueue.rb              | 4 ++--
 test/test_kqueue_io.rb           | 4 ++--
 test/test_signalfd.rb            | 4 ++--
 test/test_signalfd_siginfo.rb    | 4 ++--
 test/test_timerfd.rb             | 4 ++--
 13 files changed, 32 insertions(+), 24 deletions(-)
 create mode 100644 test/helper.rb

diff --git a/test/helper.rb b/test/helper.rb
new file mode 100644
index 0000000..13f79b7
--- /dev/null
+++ b/test/helper.rb
@@ -0,0 +1,8 @@
+$-w = $stdout.sync = $stderr.sync = Thread.abort_on_exception = true
+gem 'minitest'
+require 'minitest/autorun'
+Testcase = begin
+  Minitest::Test # minitest 5
+rescue NameError
+  Minitest::Unit::TestCase # minitest 4
+end
diff --git a/test/test_constants.rb b/test/test_constants.rb
index cafba45..4e0c90b 100644
--- a/test/test_constants.rb
+++ b/test/test_constants.rb
@@ -1,9 +1,9 @@
-require 'test/unit'
+require './test/helper'
 $-w = true
 Thread.abort_on_exception = true
 require 'sleepy_penguin/sp'
 
-class TestConstants < Test::Unit::TestCase
+class TestConstants < Testcase
   def test_constants
     assert_equal SleepyPenguin::SLEEPY_PENGUIN_VERSION,
                  SP::SLEEPY_PENGUIN_VERSION
diff --git a/test/test_epoll.rb b/test/test_epoll.rb
index 9f6cf85..ed67988 100644
--- a/test/test_epoll.rb
+++ b/test/test_epoll.rb
@@ -1,4 +1,4 @@
-require 'test/unit'
+require './test/helper'
 require 'fcntl'
 require 'socket'
 require 'thread'
@@ -7,7 +7,7 @@ Thread.abort_on_exception = true
 
 require 'sleepy_penguin'
 
-class TestEpoll < Test::Unit::TestCase
+class TestEpoll < Testcase
   include SleepyPenguin
 
   def setup
diff --git a/test/test_epoll_gc.rb b/test/test_epoll_gc.rb
index ed2df05..e2f0e10 100644
--- a/test/test_epoll_gc.rb
+++ b/test/test_epoll_gc.rb
@@ -1,9 +1,9 @@
-require 'test/unit'
+require './test/helper'
 $-w = true
 
 require 'sleepy_penguin'
 
-class TestEpollGC < Test::Unit::TestCase
+class TestEpollGC < Testcase
   include SleepyPenguin
 
   def setup
diff --git a/test/test_epoll_io.rb b/test/test_epoll_io.rb
index 05a0613..56a3808 100644
--- a/test/test_epoll_io.rb
+++ b/test/test_epoll_io.rb
@@ -1,4 +1,4 @@
-require 'test/unit'
+require './test/helper'
 require 'fcntl'
 require 'socket'
 require 'thread'
@@ -6,7 +6,7 @@ $-w = true
 Thread.abort_on_exception = true
 require 'sleepy_penguin'
 
-class TestEpollIO < Test::Unit::TestCase
+class TestEpollIO < Testcase
   include SleepyPenguin
 
   def setup
diff --git a/test/test_epoll_optimizations.rb b/test/test_epoll_optimizations.rb
index c03b9d6..4a7f787 100644
--- a/test/test_epoll_optimizations.rb
+++ b/test/test_epoll_optimizations.rb
@@ -1,4 +1,4 @@
-require 'test/unit'
+require './test/helper'
 begin
   require 'strace'
 rescue LoadError
@@ -7,7 +7,7 @@ $-w = true
 
 require 'sleepy_penguin'
 
-class TestEpollOptimizations < Test::Unit::TestCase
+class TestEpollOptimizations < Testcase
   include SleepyPenguin
   IO_PURGATORY = []
 
diff --git a/test/test_eventfd.rb b/test/test_eventfd.rb
index f04def3..731a6cb 100644
--- a/test/test_eventfd.rb
+++ b/test/test_eventfd.rb
@@ -1,10 +1,10 @@
-require 'test/unit'
+require './test/helper'
 require 'fcntl'
 $-w = true
 
 require 'sleepy_penguin'
 
-class TestEventFD < Test::Unit::TestCase
+class TestEventFD < Testcase
   include SleepyPenguin
 
   def test_constants
diff --git a/test/test_inotify.rb b/test/test_inotify.rb
index f1b257a..c91d6e4 100644
--- a/test/test_inotify.rb
+++ b/test/test_inotify.rb
@@ -1,11 +1,11 @@
-require 'test/unit'
+require './test/helper'
 require 'fcntl'
 require 'tempfile'
 require 'set'
 $-w = true
 require 'sleepy_penguin'
 
-class TestInotify < Test::Unit::TestCase
+class TestInotify < Testcase
   include SleepyPenguin
   attr_reader :ino
 
diff --git a/test/test_kqueue.rb b/test/test_kqueue.rb
index f6f21e7..5131760 100644
--- a/test/test_kqueue.rb
+++ b/test/test_kqueue.rb
@@ -1,9 +1,9 @@
-require 'test/unit'
+require './test/helper'
 $-w = true
 Thread.abort_on_exception = true
 require 'sleepy_penguin'
 
-class TestKqueue < Test::Unit::TestCase
+class TestKqueue < Testcase
   include SleepyPenguin
 
   def test_kqueue
diff --git a/test/test_kqueue_io.rb b/test/test_kqueue_io.rb
index 04e3103..e2cbe0d 100644
--- a/test/test_kqueue_io.rb
+++ b/test/test_kqueue_io.rb
@@ -1,9 +1,9 @@
-require 'test/unit'
+require './test/helper'
 $-w = true
 Thread.abort_on_exception = true
 require 'sleepy_penguin'
 
-class TestKqueueIO < Test::Unit::TestCase
+class TestKqueueIO < Testcase
   include SleepyPenguin
 
   def setup
diff --git a/test/test_signalfd.rb b/test/test_signalfd.rb
index 0330e70..c80a085 100644
--- a/test/test_signalfd.rb
+++ b/test/test_signalfd.rb
@@ -1,4 +1,4 @@
-require 'test/unit'
+require './test/helper'
 require "dl"
 begin
   require "dl/func"
@@ -7,7 +7,7 @@ end
 $-w = true
 require 'sleepy_penguin'
 
-class TestSignalFD < Test::Unit::TestCase
+class TestSignalFD < Testcase
   include SleepyPenguin
 
   def setup
diff --git a/test/test_signalfd_siginfo.rb b/test/test_signalfd_siginfo.rb
index 6b82d80..0bd55f5 100644
--- a/test/test_signalfd_siginfo.rb
+++ b/test/test_signalfd_siginfo.rb
@@ -1,8 +1,8 @@
-require 'test/unit'
+require './test/helper'
 $-w = true
 require 'sleepy_penguin'
 
-class TestSignalFDSigInfo < Test::Unit::TestCase
+class TestSignalFDSigInfo < Testcase
   include SleepyPenguin
 
   def test_members
diff --git a/test/test_timerfd.rb b/test/test_timerfd.rb
index 81aa6d3..23940a1 100644
--- a/test/test_timerfd.rb
+++ b/test/test_timerfd.rb
@@ -1,10 +1,10 @@
-require 'test/unit'
+require './test/helper'
 require 'fcntl'
 $-w = true
 
 require 'sleepy_penguin'
 
-class TestTimerFD < Test::Unit::TestCase
+class TestTimerFD < Testcase
   include SleepyPenguin
 
   def test_constants
-- 
1.8.4.483.g7fe67e6.dirty



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-19  7:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-19  7:27 [sleepy.penguin] [PATCH] tests: switch to minitest Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/sleepy_penguin.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).