Sha256: 02c45aa06212ab9a84edfd032813eacbab3481197b302969d293278dc5946f69

Contents?: true

Size: 567 Bytes

Versions: 5

Compression:

Stored size: 567 Bytes

Contents

covers 'facets/enumerable/recursively'

test_case Enumerable do

  method :recursively do

    c = Class.new do
      include Enumerable
      def initialize(ary)
        @ary = ary
      end
      def each(&b)
        @ary.each(&b)
      end
    end

    test "each" do
      e = c.new [1,2,['a','b']]
      a = []
      e.recursively(Enumerable).each{ |v| a << v }
      a.assert == [1,2,'a','b']
    end

    test "map" do
      e = c.new [1,2,['a','b']]
      a = e.recursively(Enumerable).map{ |v| v.succ }
      a.assert == [2,3,['b','c']]
    end

  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 test/core/enumerable/test_recursively.rb
facets-3.1.0 test/core/enumerable/test_recursively.rb
facets-3.0.0 test/core/enumerable/test_recursively.rb
facets-2.9.3 test/core/enumerable/test_recursively.rb
facets-2.9.2 test/core/enumerable/test_recursively.rb