mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Support svalue
This commit is contained in:
@@ -162,9 +162,9 @@ class Enumerator
|
||||
end
|
||||
|
||||
n = offset - 1
|
||||
enumerator_block_call do |i|
|
||||
enumerator_block_call do |*i|
|
||||
n += 1
|
||||
yield [i,n]
|
||||
yield i.__svalue, n
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@ end
|
||||
assert 'Enumerator#with_index' do
|
||||
assert_equal([[1,0],[2,1],[3,2]], @obj.to_enum(:foo, 1, 2, 3).with_index.to_a)
|
||||
assert_equal([[1,5],[2,6],[3,7]], @obj.to_enum(:foo, 1, 2, 3).with_index(5).to_a)
|
||||
a = []
|
||||
@obj.to_enum(:foo, 1, 2, 3).with_index(10).with_index(20) { |*i| a << i }
|
||||
assert_equal [[[1, 10], 20], [[2, 11], 21], [[3, 12], 22]], a
|
||||
end
|
||||
|
||||
assert 'Enumerator#with_index nonnum offset' do
|
||||
|
||||
Reference in New Issue
Block a user