Sha256: 547bb702ca4728bde00212a475e3ec2ec25d0cdcd31fdae2ba9856b6a124b4a8

Contents?: true

Size: 332 Bytes

Versions: 2

Compression:

Stored size: 332 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class FiberTest < Test::Unit::TestCase
  def test_fiber
    f = Fiber.new do
      (1..10).each do |i|
        Fiber.yield(i)
      end
    end
    assert_match(/.*Fiber:0x/,f.inspect)
    a = Array.new
    10.times { a << f.resume }
    assert_equal(a, [1,2,3,4,5,6,7,8,9,10])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
darkhelmet-darkext-0.11.1 test/fiber_test.rb
darkhelmet-darkext-0.11.2 test/fiber_test.rb