Skip to content

Commit

Permalink
Move some array failing specs to unsupported category
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Sep 21, 2013
1 parent 5905e6a commit 5bf10ce
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 47 deletions.
2 changes: 2 additions & 0 deletions corelib/array.rb
Expand Up @@ -752,6 +752,8 @@ def join(sep = '')
end

def keep_if(&block)
return enum_for :keep_if unless block_given?

%x{
for (var i = 0, length = #{self}.length, value; i < length; i++) {
if ((value = block(#{self}[i])) === $breaker) {
Expand Down
48 changes: 1 addition & 47 deletions spec/filters/bugs/array.rb
Expand Up @@ -2,24 +2,12 @@
fails "Array includes Enumerable"
fails "Array#at raises a TypeError when the passed argument can't be coerced to Integer"

fails "Array#clone copies frozen status from the original"
fails "Array#clone copies singleton methods"
fails "Array#clone copies untrusted status from the original"
fails "Array#clone copies taint status from the original"
fails "Array#clone creates a new array containing all elements or the original"
fails "Array#clone returns an Array or a subclass instance"

fails "Array#collect! when frozen raises a RuntimeError when calling #each on the returned Enumerator when empty"
fails "Array#collect! when frozen raises a RuntimeError when calling #each on the returned Enumerator"
fails "Array#collect! when frozen raises a RuntimeError when empty"
fails "Array#collect! when frozen raises a RuntimeError"
fails "Array#collect! keeps untrusted status"
fails "Array#collect! keeps tainted status"
fails "Array#collect! returns an Enumerator when no block given, and the enumerator can modify the original array"

fails "Array#collect does not copy untrusted status"
fails "Array#collect does not copy tainted status"

fails "Array#combination generates from a defensive copy, ignoring mutations"
fails "Array#combination yields a partition consisting of only singletons"
fails "Array#combination yields [] when length is 0"
Expand All @@ -40,21 +28,13 @@

fails "Array#concat tries to convert the passed argument to an Array using #to_ary"
fails "Array#concat does not call #to_ary on Array subclasses"
fails "Array#concat raises a RuntimeError when Array is frozen and modification occurs"
fails "Array#concat raises a RuntimeError when Array is frozen and no modification occurs"
fails "Array#concat keeps tainted status"
fails "Array#concat is not infected by the other"
fails "Array#concat keeps the tainted status of elements"
fails "Array#concat keeps untrusted status"
fails "Array#concat is not infected untrustedness by the other"
fails "Array#concat keeps the untrusted status of elements"

fails "Array#count returns the number of element for which the block evaluates to true"

fails "Array#delete_at tries to convert the passed argument to an Integer using #to_int"

fails "Array#delete_if returns an Enumerator if no block given, and the enumerator can modify the original array"
fails "Array#delete_if returns an Enumerator if no block given, and the array is frozen"

fails "Array#delete may be given a block that is executed if no element matches object"
fails "Array#delete returns the last element in the array for which object is equal under #=="
Expand All @@ -65,8 +45,6 @@

fails "Array#drop raises an ArgumentError if the number of elements specified is negative"

fails "Array#dup copies untrusted status from the original"
fails "Array#dup copies taint status from the original"
fails "Array#dup creates a new array containing all elements or the original"
fails "Array#dup returns an Array or a subclass instance"

Expand All @@ -82,7 +60,6 @@
fails "Array#[]= with [m..n] just sets the section defined by range to nil if m and n < 0 and the rhs is nil"

fails "Array#[]= sets elements in the range arguments when passed ranges"
fails "Array#[]= checks frozen before attempting to coerce arguments"
fails "Array#[]= calls to_int on its start and length arguments"
fails "Array#[]= does nothing if the section defined by range has negative width and the rhs is an empty array"

Expand Down Expand Up @@ -130,26 +107,10 @@
fails "Array#join raises a TypeError if the separator cannot be coerced to a String by calling #to_str"
fails "Array#join raises a TypeError if passed false as the separator"

fails "Array#keep_if returns an enumerator if no block is given"
fails "Array#keep_if on frozen objects returns an Enumerator if no block is given"
fails "Array#keep_if on frozen objects with truthy block keeps elements after any exception"
fails "Array#keep_if on frozen objects with truthy block raises a RuntimeError"
fails "Array#keep_if on frozen objects with falsy block keeps elements after any exception"
fails "Array#keep_if on frozen objects with falsy block raises a RuntimeError"

fails "Array#last tries to convert the passed argument to an Integer usinig #to_int"

fails "Array#map! when frozen raises a RuntimeError when calling #each on the returned Enumerator when empty"
fails "Array#map! when frozen raises a RuntimeError when calling #each on the returned Enumerator"
fails "Array#map! when frozen raises a RuntimeError when empty"
fails "Array#map! when frozen raises a RuntimeError"
fails "Array#map! keeps untrusted status"
fails "Array#map! keeps tainted status"
fails "Array#map! returns an Enumerator when no block given, and the enumerator can modify the original array"

fails "Array#map does not copy untrusted status"
fails "Array#map does not copy tainted status"

fails "Array#- removes an identical item even when its #eql? isn't reflexive"
fails "Array#- doesn't remove an item with the same hash but not #eql?"
fails "Array#- removes an item identified as equivalent via #hash and #eql?"
Expand Down Expand Up @@ -180,21 +141,14 @@
fails "Array#rassoc does not check the last element in each contained but speficically the second"
fails "Array#rassoc calls elem == obj on the second element of each contained array"

fails "Array#reject! returns an Enumerator if no block given, and the array is frozen"

fails "Array#replace raises a RuntimeError on a frozen array"
fails "Array#replace does not call #to_ary on Array subclasses"
fails "Array#replace tries to convert the passed argument to an Array using #to_ary"

fails "Array#rindex rechecks the array size during iteration"
fails "Array#rindex returns the first index backwards from the end where element == to object"

fails "Array#select returns a new array of elements for which block is true"

fails "Array#select! on frozen objects with truthy block keeps elements after any exception"
fails "Array#select! on frozen objects with truthy block raises a RuntimeError"
fails "Array#select! on frozen objects with falsy block keeps elements after any exception"
fails "Array#select! on frozen objects with falsy block raises a RuntimeError"


fails "Array#shift passed a number n as an argument raises an ArgumentError if more arguments are passed"
fails "Array#shift passed a number n as an argument raises a TypeError when the passed n can be coerced to Integer"
Expand Down
25 changes: 25 additions & 0 deletions spec/filters/unsupported/frozen.rb
Expand Up @@ -30,5 +30,30 @@
fails "Array#clear raises a RuntimeError on a frozen array"
fails "Array#<< raises a RuntimeError on a frozen array"
fails "Array#[]= raises a RuntimeError on a frozen array"
fails "Array#map! when frozen raises a RuntimeError when calling #each on the returned Enumerator when empty"
fails "Array#map! when frozen raises a RuntimeError when calling #each on the returned Enumerator"
fails "Array#map! when frozen raises a RuntimeError when empty"
fails "Array#map! when frozen raises a RuntimeError"
fails "Array#reject! returns an Enumerator if no block given, and the array is frozen"
fails "Array#replace raises a RuntimeError on a frozen array"
fails "Array#select! on frozen objects with truthy block keeps elements after any exception"
fails "Array#select! on frozen objects with truthy block raises a RuntimeError"
fails "Array#select! on frozen objects with falsy block keeps elements after any exception"
fails "Array#select! on frozen objects with falsy block raises a RuntimeError"
fails "Array#clone copies frozen status from the original"
fails "Array#collect! when frozen raises a RuntimeError when calling #each on the returned Enumerator when empty"
fails "Array#collect! when frozen raises a RuntimeError when calling #each on the returned Enumerator"
fails "Array#collect! when frozen raises a RuntimeError when empty"
fails "Array#collect! when frozen raises a RuntimeError"
fails "Array#concat raises a RuntimeError when Array is frozen and modification occurs"
fails "Array#concat raises a RuntimeError when Array is frozen and no modification occurs"
fails "Array#delete_if returns an Enumerator if no block given, and the array is frozen"
fails "Array#[]= checks frozen before attempting to coerce arguments"
fails "Array#keep_if on frozen objects returns an Enumerator if no block is given"
fails "Array#keep_if on frozen objects with truthy block keeps elements after any exception"
fails "Array#keep_if on frozen objects with truthy block raises a RuntimeError"
fails "Array#keep_if on frozen objects with falsy block keeps elements after any exception"
fails "Array#keep_if on frozen objects with falsy block raises a RuntimeError"

fails "Hash#clear raises a RuntimeError if called on a frozen instance"
end
8 changes: 8 additions & 0 deletions spec/filters/unsupported/tainted.rb
Expand Up @@ -14,4 +14,12 @@
fails "Array#* with an integer copies the taint status of the original array even if the array is empty"
fails "Array#* with an integer copies the taint status of the original array even if the passed count is 0"
fails "Array#compact does not keep tainted status even if all elements are removed"
fails "Array#map! keeps tainted status"
fails "Array#map does not copy tainted status"
fails "Array#clone copies taint status from the original"
fails "Array#collect! keeps tainted status"
fails "Array#collect does not copy tainted status"
fails "Array#concat keeps tainted status"
fails "Array#concat keeps the tainted status of elements"
fails "Array#dup copies taint status from the original"
end
9 changes: 9 additions & 0 deletions spec/filters/unsupported/trusted.rb
Expand Up @@ -12,4 +12,13 @@
fails "Array#compact! keeps untrusted status even if all elements are removed"
fails "Array#compact does not keep untrusted status even if all elements are removed"
fails "Array#clear keeps untrusted status"
fails "Array#map does not copy untrusted status"
fails "Array#clone copies untrusted status from the original"
fails "Array#collect! keeps untrusted status"
fails "Array#collect does not copy untrusted status"
fails "Array#concat keeps untrusted status"
fails "Array#concat is not infected untrustedness by the other"
fails "Array#concat keeps the untrusted status of elements"
fails "Array#dup copies untrusted status from the original"
fails "Array#map! keeps untrusted status"
end

0 comments on commit 5bf10ce

Please sign in to comment.