Sha256: bf7ea8b05d3c372636e832b7cd3fc37faa628340537a5d64d5bf7ec1f54c9873

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

$:.unshift "../lib"
require 'eventmachine'
require 'test/unit'

class TestErrorHandler < Test::Unit::TestCase
  def test_error_handler
    error = nil
    EM.error_handler{ |e|
      error = e
      EM.error_handler(nil)
      EM.stop
    }

    EM.run{
      EM.add_timer(0){
        raise 'test'
      }
    }

    assert_equal error.message, 'test'
  end

  def test_without_error_handler
    assert_raise RuntimeError do
      EM.run{
        EM.add_timer(0){
          raise 'test'
        }
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libc-eventmachine-0.12.5.42 tests/test_error_handler.rb