Skip to content
Browse files

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 <aman@tmm1.net>
  • Loading branch information...
1 parent 22e3d75 commit 006aa89f22bb25eb93280dfe38b3a2f824e3a1ee @Flameeyes Flameeyes committed with tmm1
Showing with 14 additions and 12 deletions.
  1. +14 −12 tests/test_defer.rb
View
26 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

0 comments on commit 006aa89

Please sign in to comment.
Something went wrong with that request. Please try again.