Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #744 from kostya/fill
Array#fill adapted from rubinius
- Loading branch information
Showing
with
61 additions
and 39 deletions.
- +61 −0 lib-topaz/array.rb
- +0 −39 spec/tags/core/array/fill_tags.txt
@@ -1,40 +1 @@ | ||
fails:Array#fill returns self | ||
fails:Array#fill is destructive | ||
fails:Array#fill does not replicate the filler | ||
fails:Array#fill replaces all elements in the array with the filler if not given a index nor a length | ||
fails:Array#fill replaces all elements with the value of block (index given to block) | ||
fails:Array#fill raises a RuntimeError on a frozen array | ||
fails:Array#fill raises a RuntimeError on an empty frozen array | ||
fails:Array#fill raises an ArgumentError if 4 or more arguments are passed when no block given | ||
fails:Array#fill raises an ArgumentError if no argument passed and no block given | ||
fails:Array#fill raises an ArgumentError if 3 or more arguments are passed when a block given | ||
fails:Array#fill with (filler, index, length) replaces length elements beginning with the index with the filler if given an index and a length | ||
fails:Array#fill with (filler, index, length) replaces length elements beginning with the index with the value of block | ||
fails:Array#fill with (filler, index, length) replaces all elements after the index if given an index and no length | ||
fails:Array#fill with (filler, index, length) replaces all elements after the index if given an index and nil as a length | ||
fails:Array#fill with (filler, index, length) replaces the last (-n) elements if given an index n which is negative and no length | ||
fails:Array#fill with (filler, index, length) replaces the last (-n) elements if given an index n which is negative and nil as a length | ||
fails:Array#fill with (filler, index, length) makes no modifications if given an index greater than end and no length | ||
fails:Array#fill with (filler, index, length) makes no modifications if given an index greater than end and nil as a length | ||
fails:Array#fill with (filler, index, length) replaces length elements beginning with start index if given an index >= 0 and a length >= 0 | ||
fails:Array#fill with (filler, index, length) increases the Array size when necessary | ||
fails:Array#fill with (filler, index, length) pads between the last element and the index with nil if given an index which is greater than size of the array | ||
fails:Array#fill with (filler, index, length) replaces length elements beginning with the (-n)th if given an index n < 0 and a length > 0 | ||
fails:Array#fill with (filler, index, length) starts at 0 if the negative index is before the start of the array | ||
fails:Array#fill with (filler, index, length) makes no modifications if the given length <= 0 | ||
fails:Array#fill with (filler, index, length) tries to convert the second and third arguments to Integers using #to_int | ||
fails:Array#fill with (filler, index, length) raises a TypeError if the index is not numeric | ||
fails:Array#fill with (filler, index, length) raises an ArgumentError or RangeError for too-large sizes | ||
fails:Array#fill with (filler, range) replaces elements in range with object | ||
fails:Array#fill with (filler, range) replaces all elements in range with the value of block | ||
fails:Array#fill with (filler, range) increases the Array size when necessary | ||
fails:Array#fill with (filler, range) raises a TypeError with range and length argument | ||
fails:Array#fill with (filler, range) replaces elements between the (-m)th to the last and the (n+1)th from the first if given an range m..n where m < 0 and n >= 0 | ||
fails:Array#fill with (filler, range) replaces elements between the (-m)th and (-n)th to the last if given an range m..n where m < 0 and n < 0 | ||
fails:Array#fill with (filler, range) replaces elements between the (m+1)th from the first and (-n)th to the last if given an range m..n where m >= 0 and n < 0 | ||
fails:Array#fill with (filler, range) makes no modifications if given an range which implies a section of zero width | ||
fails:Array#fill with (filler, range) makes no modifications if given an range which implies a section of negative width | ||
fails:Array#fill with (filler, range) raise an exception if some of the given range lies before the first of the array | ||
fails:Array#fill with (filler, range) tries to convert the start and end of the passed range to Integers using #to_int | ||
fails:Array#fill with (filler, range) raises a TypeError if the start or end of the passed range is not numeric | ||
fails:Array#fill with (filler, index, length) |