Skip to content

Commit

Permalink
test_defer: avoid declaring TestDeferUsage class on Ruby 1.9.
Browse files Browse the repository at this point in the history
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
Flameeyes authored and tmm1 committed May 29, 2010
1 parent 22e3d75 commit 006aa89
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/test_defer.rb
Expand Up @@ -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.