Sha256: e2843b6639532a78e91071d25da36ae133f3fb9aa9de01e799d82d86382e456c

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

class SignalTest < MiniTest::Test
  def test_Gyro_Signal_constructor
    sig = Signal.list['USR1']
    count = 0
    w = Gyro::Signal.new(sig)

    spin {
      loop {
        w.await
        count += 1
        break
      }
    }
    Thread.new do
      orig_sleep 0.001
      Process.kill(:USR1, Process.pid)
    end
    suspend
    assert_equal(1, count)
  end

  def test_wait_for_signal_api
    count = 0
    spin do
      Polyphony.wait_for_signal 'SIGHUP'
      count += 1
    end

    snooze
    Process.kill(:HUP, Process.pid)
    assert_equal 1, count
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polyphony-0.24 test/test_signal.rb
polyphony-0.23 test/test_signal.rb