Sha256: 94f1b012f8059d45cc579ae0cc365cd62f36f32599f7dd46a52b507a2a03c487
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require 'webrick' class ::WEBrick::HTTPServer ; def access_log(config, req, res) ; end ; end class ::WEBrick::BasicLog ; def log(level, data) ; end ; end class BugCrashOnDebug < Test::Unit::TestCase def test_on_progress_raise server = WEBrick::HTTPServer.new( :Port => 9999 ) server.mount_proc("/test") do|req,res| res.body = "hi" res['Content-Type'] = "text/html" end thread = Thread.new(server) do|srv| srv.start end c = Curl::Easy.new('http://127.0.0.1:9999/test') c.on_progress do|x| raise "error" end c.perform assert false, "should not reach this point" rescue => e assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s c.close ensure server&.shutdown thread&.exit end def test_on_progress_abort server = WEBrick::HTTPServer.new( :Port => 9999 ) server.mount_proc("/test") do|req,res| res.body = "hi" res['Content-Type'] = "text/html" end thread = Thread.new(server) do|srv| srv.start end # see: https://github.com/taf2/curb/issues/192, # to pass: # # c = Curl::Easy.new('http://127.0.0.1:9999/test') # c.on_progress do|x| # puts "we're in the progress callback" # false # end # c.perform # # notice no return keyword # c = Curl::Easy.new('http://127.0.0.1:9999/test') c.on_progress do|x| puts "we're in the progress callback" return false end c.perform assert false, "should not reach this point" rescue => e assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s c.close ensure server&.shutdown thread&.exit end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
curb-1.0.3 | tests/bug_crash_on_progress.rb |
curb-1.0.2 | tests/bug_crash_on_progress.rb |