Sha256: ad8bdaad762255c7fa1f51b46e0b5d8595a6037d7de324de0a47c4b748eb4bbd

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

require 'helper'

class SignalHandlerTest < Test::Unit::TestCase
  def setup
    @exp = Expectr.new("bc", flush_buffer: false, timeout: 1)
  end

  def test_winsz_change
    winsize = $stdout.winsize
    [
      Thread.new {
        sleep 0.5
        @exp.interact!.join
      },
      Thread.new {
        sleep 1
        @exp.flush_buffer = false
        assert_nothing_raised do
          $stdout.winsize = [10, 10]
        end
        sleep 0.1
        assert_equal([10, 10], @exp.winsize)
        @exp.puts("quit")
      }
    ].each { |x| x.join }

    $stdout.winsize = winsize
  end

  def test_kill_process
    assert_equal(true, @exp.kill!)
    sleep 0.5
    assert_equal(0, @exp.pid)
    assert_raises(Expectr::ProcessError) { @exp.send("test\n") }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
expectr-1.1.1 test/test_signals.rb