开发者

How to unit test for exception in threads

开发者 https://www.devze.com 2022-12-29 03:05 出处:网络
I need to unit test that an exception in raised in code like: 开发者_如何学Cdef test assert_raise Timeout::Error do

I need to unit test that an exception in raised in code like:

开发者_如何学Cdef test
  assert_raise Timeout::Error do
    Thread.new {
      raise  Timeout::Error
    }
  end
end

How to get this working?


in the assert_raise block:

t = Thread.new { raise Timeout::Error }
t.join
0

精彩评论

暂无评论...
验证码 换一张
取 消