module Minitest::Assertions
def assert_throws sym, msg = nil
def assert_throws sym, msg = nil default = "Expected #{mu_pp(sym)} to have been thrown" caught = true value = catch(sym) do begin yield rescue ThreadError => e # wtf?!? 1.8 + threads == suck default += ", not \:#{e.message[/uncaught throw \`(\w+?)\'/, 1]}" rescue ArgumentError => e # 1.9 exception raise e unless e.message.include?("uncaught throw") default += ", not #{e.message.split(/ /).last}" rescue NameError => e # 1.8 exception raise e unless e.name == sym default += ", not #{e.name.inspect}" end caught = false end assert caught, message(msg) { default } value rescue Assertion raise rescue => e raise UnexpectedError, e end