Sha256: 136fd529ac6952a2b9e23e7ee5968935ccd497a862528dfc6ec3275b8443b391
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 KB
Contents
require 'gir_ffi_test_helper' GirFFI.setup :Regress class CallbackTestException < RuntimeError; end describe 'An exception in a callback' do describe 'for signals' do let(:object) { Regress::TestSubObj.new } before do object.signal_connect 'test' do raise CallbackTestException, 'Boom' end end describe 'when the signal is emitted synchronously' do it 'raises an error' do proc { GObject.signal_emit object, 'test' }.must_raise CallbackTestException end end describe 'when the signal is emitted during an event loop' do it 'causes loop run to be terminated with an exception' do main_loop = GLib::MainLoop.new nil, false GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do GObject.signal_emit object, 'test' false end # Guard against runaway loop GLib.timeout_add GLib::PRIORITY_DEFAULT, 500 do main_loop.quit end proc do main_loop.run end.must_raise CallbackTestException end end end describe 'for other callbacks' do describe 'when the callback occurs during an event loop' do it 'causes loop run to be terminated with an exception' do main_loop = GLib::MainLoop.new nil, false GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do raise CallbackTestException, 'Boom' end # Guard against runaway loop GLib.timeout_add GLib::PRIORITY_DEFAULT, 500 do main_loop.quit end proc do main_loop.run end.must_raise CallbackTestException end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.9.2 | test/integration/callback_exceptions_test.rb |
gir_ffi-0.9.1 | test/integration/callback_exceptions_test.rb |
gir_ffi-0.9.0 | test/integration/callback_exceptions_test.rb |