Skip to content

Commit

Permalink
Add yet more string specs from rubyspec
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 30, 2013
1 parent a8a216f commit 476238d
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 120 deletions.
10 changes: 0 additions & 10 deletions spec/corelib/string/capitalize_spec.rb

This file was deleted.

16 changes: 0 additions & 16 deletions spec/corelib/string/casecmp_spec.rb

This file was deleted.

46 changes: 0 additions & 46 deletions spec/corelib/string/center_spec.rb

This file was deleted.

48 changes: 0 additions & 48 deletions spec/corelib/string/chomp_spec.rb

This file was deleted.

8 changes: 8 additions & 0 deletions spec/filters/bugs/string.rb
Expand Up @@ -26,4 +26,12 @@
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"
end
35 changes: 35 additions & 0 deletions spec/filters/unsupported/mutable_strings.rb
Expand Up @@ -11,4 +11,39 @@
fails "String#downcase! raises a RuntimeError when self is frozen"
fails "String#downcase! returns nil if no modifications were made"
fails "String#downcase! modifies self in place"
fails "String#capitalize! raises a RuntimeError when self is frozen"
fails "String#capitalize! returns nil when no changes are made"
fails "String#capitalize! capitalizes self in place"
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 a String returns nil when self is empty"
fails "String#chomp! when passed a String returns nil if the argument does not match the trailing characters"
fails "String#chomp! when passed a String removes the trailing characters if they match the argument"
fails "String#chomp! when passed an Object raises a TypeError if #to_str does not return a String"
fails "String#chomp! when passed an Object calls #to_str to convert to a String"
fails "String#chomp! when passed '\\n' returns nil when self is empty"
fails "String#chomp! when passed '\\n' taints the result if self is tainted"
fails "String#chomp! when passed '\\n' removes one trailing carrige return, newline pair"
fails "String#chomp! when passed '\\n' removes one trailing carriage return"
fails "String#chomp! when passed '\\n' removes one trailing newline"
fails "String#chomp! when passed '' returns nil when self is empty"
fails "String#chomp! when passed '' taints the result if self is tainted"
fails "String#chomp! when passed '' removes more than one trailing carriage return, newline pairs"
fails "String#chomp! when passed '' removes more than one trailing newlines"
fails "String#chomp! when passed '' does not remove a final carriage return"
fails "String#chomp! when passed '' removes a final carriage return, newline"
fails "String#chomp! when passed '' removes a final newline"
fails "String#chomp! when passed nil returns nil when self is empty"
fails "String#chomp! when passed nil returns nil"
fails "String#chomp! when passed no argument removes trailing characters that match $/ when it has been assigned a value"
fails "String#chomp! when passed no argument returns subclass instances when called on a subclass"
fails "String#chomp! when passed no argument taints the result if self is tainted"
fails "String#chomp! when passed no argument returns nil when self is empty"
fails "String#chomp! when passed no argument removes one trailing carrige return, newline pair"
fails "String#chomp! when passed no argument removes one trailing carriage return"
fails "String#chomp! when passed no argument removes one trailing newline"
fails "String#chomp! when passed no argument returns nil if self is not modified"
fails "String#chomp! when passed no argument modifies self"
fails "String#chomp! raises a RuntimeError on a frozen instance when it would not be modified"
fails "String#chomp! raises a RuntimeError on a frozen instance when it is modified"
end
3 changes: 3 additions & 0 deletions spec/filters/unsupported/string_subclasses.rb
Expand Up @@ -2,4 +2,7 @@
fails "String#upcase returns a subclass instance for subclasses"
fails "String#swapcase returns subclass instances when called on a subclass"
fails "String#downcase returns a subclass instance for subclasses"
fails "String#capitalize returns subclass instances when called on a subclass"
fails "String#center with length, padding returns subclass instances when called on subclasses"
fails "String#chomp when passed no argument returns subclass instances when called on a subclass"
end
10 changes: 10 additions & 0 deletions spec/filters/unsupported/tainted.rb
Expand Up @@ -50,4 +50,14 @@

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#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"
end
4 changes: 4 additions & 0 deletions spec/rubyspecs
Expand Up @@ -224,6 +224,10 @@ core/matchdata/to_a_spec
core/range/begin_spec
core/range/end_spec

core/string/capitalize_spec
core/string/casecmp_spec
core/string/center_spec
core/string/chomp_spec
core/string/downcase_spec
core/string/empty_spec
core/string/end_with_spec
Expand Down

0 comments on commit 476238d

Please sign in to comment.