sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: [sleepy.penguin] [PATCH] tests: switch to minitest
Date: Sat, 19 Oct 2013 07:27:58 +0000	[thread overview]
Message-ID: <20131019072758.GA8368@dcvr.yhbt.net> (raw)
In-Reply-To: <20131019072758.GA8368@dcvr.yhbt.net>

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



           reply	other threads:[~2013-10-19  7:28 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20131019072758.GA8368@dcvr.yhbt.net>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/sleepy_penguin/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131019072758.GA8368@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=sleepy.penguin@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).