File: bug_crash_on_debug.rb

package info (click to toggle)
ruby-curb 0.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 604 kB
  • ctags: 880
  • sloc: ansic: 4,242; ruby: 2,768; makefile: 3
file content (39 lines) | stat: -rw-r--r-- 857 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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

require 'curl'

class BugCrashOnDebug < Test::Unit::TestCase

  def test_on_debug
    server = WEBrick::HTTPServer.new( :Port => 9999 )
    server.mount_proc("/test") do|req,res|
      res.body = "hi"
      res['Content-Type'] = "text/html"
    end
    puts 'a'
    thread = Thread.new(server) do|srv|
      srv.start
    end
    puts 'b'
    c = Curl::Easy.new('http://127.0.0.1:9999/test')
    c.on_debug do|x|
      puts x.inspect
      raise "error" # this will get swallowed
    end
    c.perform
    puts 'c'
  ensure
    puts 'd'
    server.shutdown
    puts 'e'
    puts thread.exit
    puts 'f'
  end

end

#test_on_debug