From: Kouhei S. <nu...@co...> - 2017-10-28 12:26:40
|
Kouhei Sutou 2017-10-28 21:18:44 +0900 (Sat, 28 Oct 2017) New Revision: f666c933e52656b43eefa39ea07e0c05867959f1 https://github.com/ruby-gnome2/ruby-gnome2/commit/f666c933e52656b43eefa39ea07e0c05867959f1 Message: glib2 test: ensure removing source Modified files: glib2/test/test-iochannel.rb Modified: glib2/test/test-iochannel.rb (+18 -8) =================================================================== --- glib2/test/test-iochannel.rb 2017-10-28 20:59:43 +0900 (079022559) +++ glib2/test/test-iochannel.rb 2017-10-28 21:18:44 +0900 (74835d21d) @@ -295,12 +295,17 @@ class TestGIOChannel < Test::Unit::TestCase received_condition = nil source = channel.create_watch(GLib::IOChannel::IN) do |_, condition| received_condition = condition + GLib::Source::CONTINUE end - source.attach(@context) - 10.times do - @context.iteration(false) + begin + source.attach(@context) + 10.times do + @context.iteration(false) + end + assert_equal(GLib::IOCondition::IN, received_condition) + ensure + source.destroy end - assert_equal(GLib::IOCondition::IN, received_condition) end end @@ -310,12 +315,17 @@ class TestGIOChannel < Test::Unit::TestCase source = channel.create_watch(GLib::IOChannel::IN) source.set_callback do |_, condition| received_condition = condition + GLib::Source::CONTINUE end - source.attach(@context) - 10.times do - @context.iteration(false) + begin + source.attach(@context) + 10.times do + @context.iteration(false) + end + assert_equal(GLib::IOCondition::IN, received_condition) + ensure + source.destroy end - assert_equal(GLib::IOCondition::IN, received_condition) end end end |