Sha256: 2b8b65606f44204bba9d1509002eaabb83e28895973dd1a6185a80cd14167e61

Contents?: true

Size: 400 Bytes

Versions: 1

Compression:

Stored size: 400 Bytes

Contents

require 'helper'

class TestLazyeval < Test::Unit::TestCase
  should "call a simple method lazily" do
    src = [:a, :b]
    x = src.lazy.shift
    assert_equal [:a, :b], src
    assert x === :a
    assert_equal [:b], src
  end

  should "call a block lazily" do
    src = [1, 2]
    x = src.lazy { |x| x.shift*3 }

    assert_equal [1, 2], src
    assert x === 3
    assert_equal [2], src
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lazyeval-0.0.3 test/test_lazyeval.rb