Skip to content

Commit

Permalink
Cleanup some spec filters
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Nov 13, 2013
1 parent 8bcb3ed commit 47a3d47
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 70 deletions.
6 changes: 0 additions & 6 deletions spec/filters/bugs/array.rb
Expand Up @@ -202,12 +202,6 @@
fails "Array#hash returns the same hash for equal recursive arrays"
fails "Array#hash returns the same fixnum for arrays with the same content"

fails "Array#initialize_copy tries to convert the passed argument to an Array using #to_ary"
fails "Array#initialize_copy does not make self dependent to the original array"
fails "Array#initialize_copy returns self"
fails "Array#initialize_copy properly handles recursive arrays"
fails "Array#initialize_copy replaces the elements with elements from other array"

fails "Array#partition properly handles recursive arrays"
fails "Array#partition returns in the left array values for which the block evaluates to true"
fails "Array#partition returns two arrays"
Expand Down
41 changes: 22 additions & 19 deletions spec/filters/bugs/string.rb
@@ -1,36 +1,39 @@
opal_filter "String" do
fails "String#capitalize is locale insensitive (only upcases a-z and only downcases A-Z)"

fails "String#center with length, padding raises an ArgumentError if padstr is empty"
fails "String#center with length, padding raises a TypeError when padstr can't be converted to a string"
fails "String#center with length, padding calls #to_str to convert padstr to a String"
fails "String#center with length, padding raises a TypeError when length can't be converted to an integer"
fails "String#center with length, padding calls #to_int to convert length to an integer"
fails "String#center with length, padding pads with whitespace if no padstr is given"
fails "String#center with length, padding returns a new string of specified length with self centered and padded with padstr"

fails "String#lines should split on the default record separator and return enumerator if not block is given"
fails "String#downcase is locale insensitive (only replaces A-Z)"

fails "String#upcase is locale insensitive (only replaces a-z)"
fails "String#size returns the length of self"
fails "String#length returns the length of self"
fails "String#end_with? converts its argument using :to_str"
fails "String#end_with? returns true if other is empty"

fails "String#index raises a TypeError if passed a Symbol"
# we need regexp rewriting for these
fails "String#index with Regexp supports \\G which matches at the given start offset"
fails "String#index with Regexp starts the search at the given offset"
fails "String#index with Regexp returns the index of the first match of regexp"

fails "String#index raises a TypeError if passed a Symbol"

fails "String#intern does not special case certain operators"
fails "String#intern special cases +(binary) and -(binary)"
fails "String#to_sym special cases +(binary) and -(binary)"

fails "String#length returns the length of self"

fails "String#lines should split on the default record separator and return enumerator if not block is given"

fails "String#size returns the length of self"

fails "String#start_with? ignores arguments not convertible to string"
fails "String#start_with? converts its argument using :to_str"
fails "String#end_with? converts its argument using :to_str"
fails "String#end_with? returns true if other is empty"
fails "String#downcase is locale insensitive (only replaces A-Z)"
fails "String#intern does not special case certain operators"

fails "String#to_sym does not special case certain operators"
fails "String#capitalize is locale insensitive (only upcases a-z and only downcases A-Z)"
fails "String#center with length, padding raises an ArgumentError if padstr is empty"
fails "String#center with length, padding raises a TypeError when padstr can't be converted to a string"
fails "String#center with length, padding calls #to_str to convert padstr to a String"
fails "String#center with length, padding raises a TypeError when length can't be converted to an integer"
fails "String#center with length, padding calls #to_int to convert length to an integer"
fails "String#chomp when passed an Object raises a TypeError if #to_str does not return a String"
fails "String#chomp when passed no argument returns a copy of the String when it is not modified"
fails "String#to_sym special cases +(binary) and -(binary)"

fails "String#upcase is locale insensitive (only replaces a-z)"
end
15 changes: 15 additions & 0 deletions spec/filters/unsupported/immutable_strings.rb
Expand Up @@ -6,4 +6,19 @@
fails "Time#strftime formats time according to the directives in the given format string"
fails "Time#strftime with %z formats a local time with positive UTC offset as '+HHMM'"
fails "Time#strftime with %z formats a local time with negative UTC offset as '-HHMM'"

fails "String#chomp when passed no argument returns a copy of the String when it is not modified"

fails "String#chop returns a new string when applied to an empty string"

fails "String#chop! removes the final character"
fails "String#chop! removes the final carriage return"
fails "String#chop! removes the final newline"
fails "String#chop! removes the final carriage return, newline"
fails "String#chop! removes the carrige return, newline if they are the only characters"
fails "String#chop! does not remove more than the final carriage return, newline"
fails "String#chop! returns self if modifications were made"
fails "String#chop! returns nil when called on an empty string"
fails "String#chop! raises a RuntimeError on a frozen instance that is modified"
fails "String#chop! raises a RuntimeError on a frozen instance that would not be modified"
end
88 changes: 58 additions & 30 deletions spec/filters/unsupported/tainted.rb
@@ -1,63 +1,91 @@
opal_filter 'tainted' do
fails "Array#clear keeps tainted status"
fails "Array#compact! keeps tainted status even if all elements are removed"
fails "Array#delete_at keeps tainted status"
fails "Array#delete_if keeps tainted status"
fails "Array#delete keeps tainted status"
fails "Array#shift passed a number n as an argument keeps taint status"
fails "Array#shift passed a number n as an argument returns an untainted array even if the array is tainted"
fails "Array#pop passed a number n as an argument keeps taint status"
fails "Array#pop passed a number n as an argument returns an untainted array even if the array is tainted"
fails "Array#pop keeps taint status"
fails "Array#+ does not get infected even if an original array is tainted"
fails "Kernel#to_s returns a tainted result if self is tainted"

fails "Array#* with a string with a tainted separator taints the result if the array has two or more elements"
fails "Array#* with a string with a tainted separator does not taint the result if the array has only one element"
fails "Array#* with a string with a tainted separator does not taint the result if the array is empty"
fails "Array#* with an integer copies the taint status of the original array if the passed count is not 0"
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#+ does not get infected even if an original array is tainted"

fails "Array#clear keeps 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#collect! keeps tainted status"

fails "Array#compact does not keep tainted status even if all elements are removed"

fails "Array#compact! keeps tainted status even if all elements are removed"

fails "Array#concat keeps tainted status"
fails "Array#concat keeps the tainted status of elements"

fails "Array#delete keeps tainted status"

fails "Array#delete_at keeps tainted status"

fails "Array#delete_if keeps tainted status"

fails "Array#dup copies taint status from the original"

fails "Array#inspect taints the result if an element is tainted"
fails "Array#inspect does not taint the result if the Array is tainted but empty"
fails "Array#inspect taints the result if the Array is non-empty and tainted"
fails "Array#to_s taints the result if an element is tainted"
fails "Array#to_s does not taint the result if the Array is tainted but empty"
fails "Array#to_s taints the result if the Array is non-empty and tainted"

fails "Array#join with a tainted separator taints the result if the array has two or more elements"
fails "Array#join with a tainted separator does not taint the result if the array has only one element"
fails "Array#join with a tainted separator does not taint the result if the array is empty"
fails "Array#join taints the result if the result of coercing an element is tainted"
fails "Array#join does not taint the result if the Array is tainted but empty"
fails "Array#join taints the result if the Array is tainted and non-empty"
fails "Array#* with a string with a tainted separator taints the result if the array has two or more elements"
fails "Array#* with a string with a tainted separator does not taint the result if the array has only one element"
fails "Array#* with a string with a tainted separator does not taint the result if the array is empty"

fails "Hash#reject taints the resulting hash"
fails "Array#pop passed a number n as an argument keeps taint status"
fails "Array#pop passed a number n as an argument returns an untainted array even if the array is tainted"
fails "Array#pop keeps taint status"

fails "Kernel#to_s returns a tainted result if self is tainted"
fails "Array#map! keeps tainted status"
fails "Array#map does not copy tainted status"

fails "String#upcase taints result when self is tainted"
fails "String#to_s taints the result when self is tainted"
fails "String#to_str taints the result when self is tainted"
fails "String#swapcase taints resulting string when self is tainted"
fails "String#reverse taints the result if self is tainted"
fails "Array#shift passed a number n as an argument keeps taint status"
fails "Array#shift passed a number n as an argument returns an untainted array even if the array is tainted"

fails "Array#to_s taints the result if an element is tainted"
fails "Array#to_s does not taint the result if the Array is tainted but empty"
fails "Array#to_s taints the result if the Array is non-empty and tainted"

fails "Hash#reject taints the resulting hash"

fails "Pathname.new is tainted if path is tainted"
fails "String#downcase taints result when self is tainted"
fails "String#capitalize taints resulting string when self is tainted"

fails "String#downcase taints result when self is tainted"

fails "String#center with length, padding when padding is tainted and self is untainted returns a tainted string if and only if length is longer than self"
fails "String#center with length, padding taints result when self or padstr is tainted"

fails "String#chomp when passed a String does not taint the result when the argument is tainted"
fails "String#chomp when passed a String taints the result if self is tainted"
fails "String#chomp when passed '\\n' taints the result if self is tainted"
fails "String#chomp when passed '' taints the result if self is tainted"
fails "String#chomp when passed nil taints the result if self is tainted"
fails "String#chomp when passed nil returns a copy of the String"
fails "String#chomp when passed no argument taints the result if self is tainted"

fails "String#chop taints result when self is tainted"

fails "String#reverse taints the result if self is tainted"

fails "String#swapcase taints resulting string when self is tainted"

fails "String#to_s taints the result when self is tainted"

fails "String#to_str taints the result when self is tainted"

fails "String#upcase taints result when self is tainted"

fails "Pathname.new is tainted if path is tainted"
end
50 changes: 35 additions & 15 deletions spec/filters/unsupported/trusted.rb
@@ -1,41 +1,61 @@
opal_filter "Object#trusted/untrusted" do
fails "Array#pop passed a number n as an argument keeps untrusted status"
fails "Array#pop passed a number n as an argument returns a trusted array even if the array is untrusted"
fails "Array#pop keeps untrusted status"
fails "Kernel#to_s returns an untrusted result if self is untrusted"

fails "Array#+ does not infected even if an original array is untrusted"

fails "Array#* with an integer copies the untrusted status of the original array if the passed count is not 0"
fails "Array#* with an integer copies the untrusted status of the original array even if the array is empty"
fails "Array#* with an integer copies the untrusted status of the original array even if the passed count is 0"
fails "Array#* with a string with an untrusted separator untrusts the result if the array has two or more elements"
fails "Array#* with a string with an untrusted separator does not untrust the result if the array has only one element"
fails "Array#* with a string with an untrusted separator does not untrust the result if the array is empty"

fails "Array#delete keeps untrusted status"

fails "Array#delete_if keeps untrusted status"

fails "Array#delete_at keeps untrusted status"
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#compact does not keep untrusted status even if all elements are removed"

fails "Array#compact! keeps untrusted status even if all elements are removed"

fails "Array#collect! keeps 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"

fails "Array#inspect untrusts the result if an element is untrusted"
fails "Array#inspect does not untrust the result if the Array is untrusted but empty"
fails "Array#inspect untrusts the result if the Array is untrusted"
fails "Array#to_s untrusts the result if an element is untrusted"
fails "Array#to_s does not untrust the result if the Array is untrusted but empty"
fails "Array#to_s untrusts the result if the Array is untrusted"

fails "Array#join with an untrusted separator untrusts the result if the array has two or more elements"
fails "Array#join with an untrusted separator does not untrust the result if the array has only one element"
fails "Array#join with an untrusted separator does not untrust the result if the array is empty"
fails "Array#join untrusts the result if the result of coercing an element is untrusted"
fails "Array#join does not untrust the result if the Array is untrusted but empty"
fails "Array#join untrusts the result if the Array is untrusted and non-empty"
fails "Array#* with a string with an untrusted separator untrusts the result if the array has two or more elements"
fails "Array#* with a string with an untrusted separator does not untrust the result if the array has only one element"
fails "Array#* with a string with an untrusted separator does not untrust the result if the array is empty"

fails "Kernel#to_s returns an untrusted result if self is untrusted"
fails "Array#map does not copy untrusted status"

fails "Array#pop passed a number n as an argument keeps untrusted status"
fails "Array#pop passed a number n as an argument returns a trusted array even if the array is untrusted"
fails "Array#pop keeps untrusted status"

fails "Array#map! keeps untrusted status"

fails "Array#to_s untrusts the result if an element is untrusted"
fails "Array#to_s does not untrust the result if the Array is untrusted but empty"
fails "Array#to_s untrusts the result if the Array is untrusted"

fails "String#chop untrusts result when self is untrusted"
end

0 comments on commit 47a3d47

Please sign in to comment.