Sha256: 14201a1e05fbbca34e18849383c07ea24ea9690589810f2d422005d3f41ded23

Contents?: true

Size: 518 Bytes

Versions: 8

Compression:

Stored size: 518 Bytes

Contents

require 'helper'

module Bixby
module Test
class TestSignal < TestCase

  def test_create_signal

    foo = 0
    thread = Bixby::Signal.trap("ALRM") do
      foo += 1
    end

    assert thread.kind_of? Thread
    assert thread.alive?
    assert_equal 0, foo

    Process.kill("ALRM", Process.pid)
    sleep 0.01
    assert_equal 1, foo

    Process.kill("ALRM", Process.pid)
    sleep 0.01
    assert_equal 2, foo

    assert thread.alive?
    thread.kill
    thread.join
    refute thread.alive?
  end

end
end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bixby-common-0.7.1 test/util/signal_test.rb
bixby-common-0.7.0 test/util/signal_test.rb
bixby-common-0.6.6 test/util/signal_test.rb
bixby-common-0.6.5 test/util/signal_test.rb
bixby-common-0.6.4 test/util/signal_test.rb
bixby-common-0.6.3 test/util/signal_test.rb
bixby-common-0.6.2 test/util/signal_test.rb
bixby-common-0.6.1 test/util/signal_test.rb