Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get the tests passing

  • Loading branch information...
commit 6d0a61000875686e7a362b2013cbf9c943c5081c 1 parent 140da7e
@careo authored
View
8 Rakefile
@@ -1,5 +1,6 @@
require 'rubygems'
require 'rake'
+require 'rake/testtask'
require 'spec'
require 'spec/rake/spectask'
@@ -10,6 +11,13 @@ Spec::Rake::SpecTask.new do |t|
t.spec_opts = ["--format specdoc"]
end
+desc "Run all tests"
+Rake::TestTask.new do |t|
+ #t.warning = true
+ t.libs = ['lib', 'test']
+ t.pattern = 'test/*_test.rb'
+end
+
task :default => :spec
Dir['tasks/*.rake'].each { |rake| load rake }
View
11 lib/neverblock.rb
@@ -2,9 +2,6 @@
# Copyright:: Copyright (c) 2008 eSpace, Inc.
# License:: Distributes under the same terms as Ruby
-$:.unshift File.expand_path(File.dirname(__FILE__))
-
-
module NeverBlock
# Checks if we should be working in a non-blocking mode
@@ -29,6 +26,8 @@ class NBError < StandardError
NB = NeverBlock
-require 'neverblock/core/reactor'
-require 'neverblock/core/fiber'
-require 'neverblock/core/pool'
+require_relative 'neverblock/core/reactor'
+require_relative 'neverblock/core/fiber'
+require_relative 'neverblock/core/pool'
+require_relative 'neverblock/system'
+require_relative 'neverblock/neverblock_io'
View
2  lib/neverblock/core/reactor.rb
@@ -4,6 +4,8 @@
module NeverBlock
+ @@reactors = {}
+
def self.reactor
@@reactors[Thread.current.object_id] ||= ::Reactor::Base.new
end
View
0  lib/neverblock_io.rb → lib/neverblock/neverblock_io.rb
File renamed without changes
View
0  lib/system.rb → lib/neverblock/system.rb
File renamed without changes
View
3  test/fiber_test.rb
@@ -1,11 +1,10 @@
-require 'minitest/unit'
+require_relative 'test_helper'
MiniTest::Unit.autorun
class NeverBlockFiberTest < MiniTest::Unit::TestCase
def setup
super
- require_relative '../lib/neverblock'
@fiber = NeverBlock::Fiber.new{ x = NB::Fiber.yield 1 }
end
View
3  test/reactor_test.rb
@@ -1,11 +1,10 @@
-require 'minitest/unit'
+require_relative 'test_helper'
MiniTest::Unit.autorun
class NeverBlockReactorTest < MiniTest::Unit::TestCase
def setup
super
- require '../lib/neverblock'
@reactor = NeverBlock.reactor
end
View
3  test/socket_test.rb
@@ -1,4 +1,4 @@
-require 'minitest/unit'
+require_relative 'test_helper'
MiniTest::Unit.autorun
@@ -20,7 +20,6 @@ def setup
end
sleep 0.5
super
- require_relative '../lib/io'
end
def test_tcpsocket_recv
View
8 test/system_test.rb
@@ -1,13 +1,9 @@
-require 'minitest/unit'
+require_relative 'test_helper'
MiniTest::Unit.autorun
class SystemTest < MiniTest::Unit::TestCase
- def setup
- super
- require_relative '../lib/system'
-
- end
+
def test_sleep
run_in_reactor do
t = Time.now
View
3  test/test_helper.rb
@@ -0,0 +1,3 @@
+require 'minitest/unit'
+
+require_relative "../lib/neverblock"
Please sign in to comment.
Something went wrong with that request. Please try again.