From 006aa89f22bb25eb93280dfe38b3a2f824e3a1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 26 Apr 2010 15:36:01 +0200 Subject: [PATCH] test_defer: avoid declaring TestDeferUsage class on Ruby 1.9. Since the only test present in the class would be skipped under Ruby 1.9, avoid declaring the whole class, leaving the file empty. This change is necessary for the testsuite to pass green when test-unit-2 is installed, as empty Test::Unit::TestCase-derived classes produce errors. Signed-off-by: Aman Gupta --- tests/test_defer.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/test_defer.rb b/tests/test_defer.rb index e7fad1289..be3c5c7b3 100644 --- a/tests/test_defer.rb +++ b/tests/test_defer.rb @@ -28,20 +28,22 @@ require 'eventmachine' require 'test/unit' -class TestDeferUsage < Test::Unit::TestCase +unless RUBY_VERSION >= '1.9.0' + class TestDeferUsage < Test::Unit::TestCase - def test_defers - n = 0 - n_times = 20 - EM.run { - n_times.times { - work_proc = proc { n += 1 } - callback = proc { EM.stop if n == n_times } - EM.defer work_proc, callback + def test_defers + n = 0 + n_times = 20 + EM.run { + n_times.times { + work_proc = proc { n += 1 } + callback = proc { EM.stop if n == n_times } + EM.defer work_proc, callback + } } - } - assert_equal( n, n_times ) - end unless RUBY_VERSION >= '1.9.0' + assert_equal( n, n_times ) + end + end end