Sha256: 53797c8d33fb2b79c16b4feccfb8fb9b9fc27d217ca12764c7ff8f194332a69d

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

class KernelTest < MiniTest::Test
  def test_system_method
    counter = 0
    timer = spin { throttled_loop(200) { counter += 1 } }

    system('sleep 0.01')
    assert(counter >= 2)

    i, o = IO.pipe
    orig_stdout = $stdout
    $stdout = o
    system('echo "hello"')
    o.close
    assert_equal "hello\n", i.read
  ensure
    $stdout = orig_stdout
    timer&.stop
  end

  def test_backtick_method
    counter = 0
    timer = spin { throttled_loop(200) { counter += 1 } }

    `sleep 0.01`
    assert(counter >= 2)

    result = `echo "hello"`
    assert_equal "hello\n", result
  ensure
    timer&.stop
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
polyphony-0.32 test/test_kernel.rb
polyphony-0.31 test/test_kernel.rb
polyphony-0.30 test/test_kernel.rb
polyphony-0.29 test/test_kernel.rb
polyphony-0.28 test/test_kernel.rb
polyphony-0.27 test/test_kernel.rb
polyphony-0.26 test/test_kernel.rb
polyphony-0.25 test/test_kernel.rb