Permalink
Browse files

Move to Rake::TestTask, turn on warnings, and cleanup warnings

  • Loading branch information...
1 parent 677362b commit 0e7d8b8d79fdc23be01b7efa564e95336b22c4fd @raggi raggi committed Oct 4, 2009
View
@@ -53,9 +53,9 @@ def self.new(sig, *args) #:nodoc:
def initialize(*args) #:nodoc:
end
- def associate_callback_target(sig) #:nodoc:
- # no-op for the time being, to match similar no-op in rubymain.cpp
- end
+ # def associate_callback_target(sig) #:nodoc:
+ # # no-op for the time being, to match similar no-op in rubymain.cpp
+ # end
# EventMachine::Connection#post_init is called by the event loop
# immediately after the network connection has been established,
View
@@ -42,6 +42,7 @@ module Deferrable
#
def callback &block
return unless block
+ @deferred_status ||= :unknown
if @deferred_status == :succeeded
block.call(*@deferred_args)
elsif @deferred_status != :failed
@@ -59,6 +60,7 @@ def callback &block
#
def errback &block
return unless block
+ @deferred_status ||= :unknown
if @deferred_status == :failed
block.call(*@deferred_args)
elsif @deferred_status != :succeeded
@@ -121,6 +123,8 @@ def errback &block
#
def set_deferred_status status, *args
cancel_timeout
+ @errbacks ||= nil
+ @callbacks ||= nil
@deferred_status = status
@deferred_args = args
case @deferred_status
@@ -155,6 +159,7 @@ def timeout seconds
# Cancels an outstanding timeout if any. Undoes the action of #timeout.
#
def cancel_timeout
+ @deferred_timeout ||= nil
if @deferred_timeout
@deferred_timeout.cancel
@deferred_timeout = nil
@@ -33,6 +33,7 @@ class DelegateConnection < Connection
def initialize(delegate)
@delegate = delegate
@delegate.init(self)
+ @ip, @port = nil, nil
end
# Retreive the connections ip and port from the reactor.
@@ -40,6 +40,12 @@ module Protocols
# }
class HttpClient2 < Connection
include LineText2
+
+ def initialize
+ @authorization = nil
+ @closed = nil
+ @requests = nil
+ end
class Request # :nodoc:
include Deferrable
@@ -57,6 +63,8 @@ def initialize conn, args
@header_lines = []
@headers = {}
@blanks = 0
+ @chunk_trailer = nil
+ @chunking = nil
end
def send_request
@@ -23,7 +23,6 @@
#
#
#
-require File.dirname(__FILE__) + '/../buftok'
module EventMachine
module Protocols
@@ -132,6 +132,7 @@ def set_binary_mode size=nil
# when in sized text mode. User overrides of #receive_binary_data need to
# be aware that they may get a short buffer.
def unbind
+ @lt2_mode ||= nil
if @lt2_mode == :text and @lt2_textpos > 0
receive_binary_data @lt2_textbuffer.join
end
@@ -66,6 +66,13 @@ module Protocols
class SmtpClient < Connection
include EventMachine::Deferrable
include EventMachine::Protocols::LineText2
+
+ def initialize
+ @succeeded = nil
+ @responder = nil
+ @code = nil
+ @msg = nil
+ end
# :host => required String
# a string containing the IP address or host name of the SMTP server to connect to.
View
@@ -48,7 +48,7 @@ def set_delegate(delegate)
when Module
[Class.new(EM::Connection) { include delegate }]
when Proc
- [Module.new &delegate]
+ [Module.new(&delegate)]
# when nil # TODO
# LoggerConnection
else
View
@@ -31,6 +31,7 @@ class PeriodicTimer
def initialize interval, callback=nil, &block
@interval = interval
@code = callback || block
+ @cancelled = false
schedule
end
View
@@ -191,6 +191,10 @@ class <<self
attr_reader :reactor_thread
end
@next_tick_mutex = Mutex.new
+ @reactor_running = false
+ @next_tick_queue = nil
+ @threadpool = nil
+
# EventMachine::run initializes and runs an event loop.
# This method only returns if user-callback code calls stop_event_loop.
View
@@ -22,11 +22,10 @@ def run_tests t, libr = :cascade, test_files="test_*.rb"
runner.run(suite)
end
-desc "Run tests for #{Spec.name}."
-task :test do |t|
- # run_tests t
- # Rake +/ friends leave threads, etc, less stable test runs.
- ruby "-Ilib -Iext -Iext/fastfilereader -Ijava tests/testem.rb #{'-v' if ENV['VERBOSE']}"
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |t|
+ t.pattern = 'tests/**/test_*.rb'
+ t.warning = true
end
namespace :test do
View
@@ -9,18 +9,29 @@ def self._set_mocks
class <<self
alias set_tls_parms_old set_tls_parms
alias start_tls_old start_tls
- def set_tls_parms *args; end
- def start_tls *args; end
+ begin
+ old, $VERBOSE = $VERBOSE, nil
+ def set_tls_parms *args; end
+ def start_tls *args; end
+ ensure
+ $VERBOSE = old
+ end
end
end
-
+
def self._clear_mocks
class <<self
- alias set_tls_parms set_tls_parms_old
- alias start_tls start_tls_old
+ begin
+ old, $VERBOSE = $VERBOSE, nil
+ alias set_tls_parms set_tls_parms_old
+ alias start_tls start_tls_old
+ ensure
+ $VERBOSE = old
+ end
end
end
end
+
class TestSslArgs < Test::Unit::TestCase

0 comments on commit 0e7d8b8

Please sign in to comment.