Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ce378612c905
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 247d921f43e2
Choose a head ref
  • 2 commits
  • 8 files changed
  • 2 contributors

Commits on Aug 2, 2015

  1. Update to latest RubySpec

    vais committed Aug 2, 2015
    Copy the full SHA
    7f2be57 View commit details
  2. Merge pull request #1042 from vais/rubyspec

    Update to latest RubySpec
    elia committed Aug 2, 2015
    Copy the full SHA
    247d921 View commit details
Showing with 26 additions and 10 deletions.
  1. +6 −1 opal/corelib/array.rb
  2. +5 −8 spec/filters/bugs/array.rb
  3. +3 −0 spec/filters/bugs/date.rb
  4. +4 −0 spec/filters/bugs/kernel.rb
  5. +4 −0 spec/filters/bugs/module.rb
  6. +1 −0 spec/filters/bugs/range.rb
  7. +2 −0 spec/filters/unsupported/array.rb
  8. +1 −1 spec/rubyspec
7 changes: 6 additions & 1 deletion opal/corelib/array.rb
Original file line number Diff line number Diff line change
@@ -1513,17 +1513,22 @@ def rindex(object = undefined, &block)
if (object != null) {
for (i = self.length - 1; i >= 0; i--) {
if (i >= self.length) {
break;
}
if (#{`self[i]` == `object`}) {
return i;
}
}
}
else if (block !== nil) {
for (i = self.length - 1; i >= 0; i--) {
if (i >= self.length) {
break;
}
if ((value = block(self[i])) === $breaker) {
return $breaker.$v;
}
if (value !== false && value !== nil) {
return i;
}
13 changes: 5 additions & 8 deletions spec/filters/bugs/array.rb
Original file line number Diff line number Diff line change
@@ -3,12 +3,10 @@
fails "Array#clone copies singleton methods"
fails "Array#combination when no block is given returned Enumerator size returns 0 when the number of combinations is < 0"
fails "Array#combination when no block is given returned Enumerator size returns the binomial coeficient between the array size the number of combinations"
fails "Array#first raises a RangeError when count is a Bignum"
fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array"
fails "Array#flatten with a non-Array object in the Array calls #method_missing if defined"
fails "Array#flatten with a non-Array object in the Array calls #to_ary if not defined when #respond_to_missing? returns true"
fails "Array#flatten with a non-Array object in the Array does not call #to_ary if not defined when #respond_to_missing? returns false"
fails "Array#hash returns the same fixnum for arrays with the same content"
fails "Array#hash returns the same hash for equal recursive arrays through hashes"
fails "Array#initialize preserves the object's identity even when changing its value"
fails "Array#initialize with (size, object=nil) returns the value passed to break"
@@ -22,9 +20,9 @@
fails "Array#permutation when no block is given returned Enumerator size with an array size greater than 0 returns the descending factorial of array size with array size when there's no param"
fails "Array#permutation when no block is given returned Enumerator size with an empty array returns 1 when the given length is 0"
fails "Array#permutation when no block is given returned Enumerator size with an empty array returns 1 when there's param"
fails "Array#pop passed a number n as an argument raises an ArgumentError if more arguments are passed"
fails "Array#rassoc calls elem == obj on the second element of each contained array"
fails "Array#rassoc does not check the last element in each contained but speficically the second"
fails "Array#pop passed a number n as an argument raises an ArgumentError if more arguments are passed" #Arity issue?
fails "Array#rassoc calls elem == obj on the second element of each contained array" #Spec assumes string and symbols are not equal.
fails "Array#rassoc does not check the last element in each contained but speficically the second" #Spec assumes string and symbols are not equal.
fails "Array#repeated_combination accepts sizes larger than the original array"
fails "Array#repeated_combination generates from a defensive copy, ignoring mutations"
fails "Array#repeated_combination returns an enumerator when no block is provided"
@@ -48,9 +46,8 @@
fails "Array#repeated_permutation when no block is given returned Enumerator size returns array size ** combination_size"
fails "Array#repeated_permutation yields all repeated_permutations to the block then returns self when called with block but no arguments"
fails "Array#repeated_permutation yields the empty repeated_permutation ([[]]) when the given length is 0"
fails "Array#rindex rechecks the array size during iteration"
fails "Array#select returns a new array of elements for which block is true"
fails "Array#shift passed a number n as an argument raises an ArgumentError if more arguments are passed"
fails "Array#select returns a new array of elements for which block is true" #Spec assumes integer division
fails "Array#shift passed a number n as an argument raises an ArgumentError if more arguments are passed" #Arity issue?
fails "Array#shuffle accepts a Float for the value returned by #rand"
fails "Array#shuffle attempts coercion via #to_hash"
fails "Array#shuffle calls #rand on the Object passed by the :random key in the arguments Hash"
3 changes: 3 additions & 0 deletions spec/filters/bugs/date.rb
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
fails "Date#<=> returns -1 when self is less than a Numeric"
fails "Date#<=> returns 1 when self is greater than a Numeric"
fails "Date#=== compares to another numeric"
fails "Date#>> returns the day of the reform if date falls within calendar reform"
fails "Date#ajd determines the Astronomical Julian day"
fails "Date#amjd determines the Astronomical Modified Julian day"
fails "Date#civil creates a Date for -4712 by default"
@@ -43,6 +44,7 @@
fails "Date#mjd determines the Modified Julian day"
fails "Date#mon determines the month"
fails "Date#new_start converts a date object into another with a new calendar reform"
fails "Date#next_year returns the day of the reform if date falls within calendar reform"
fails "Date#parse parses DD as month day number"
fails "Date#parse parses DDD as year day number"
fails "Date#parse parses MMDD as month and day"
@@ -94,6 +96,7 @@
fails "Date#parse(.) parses YY.MM.DD into a Date object using the year 20YY"
fails "Date#parse(.) parses YY.MM.DD using the year digits as 20YY when given true as additional argument"
fails "Date#parse(.) parses YYYY.MM.DD into a Date object"
fails "Date#prev_year returns the day of the reform if date falls within calendar reform"
fails "Date#step steps backward in time"
fails "Date#step steps forward in time"
fails "Date#strftime should be able to print the commercial year with leading zeroes"
4 changes: 4 additions & 0 deletions spec/filters/bugs/kernel.rb
Original file line number Diff line number Diff line change
@@ -184,6 +184,7 @@
fails "Kernel#public_send raises a NoMethodError if the named method is an alias of a protected method"
fails "Kernel#public_send raises a NoMethodError if the named method is private"
fails "Kernel#puts calls to_s before writing non-string objects"
fails "Kernel#puts delegates to $stdout.puts"
fails "Kernel#puts does not write a newline after objects that end in newlines"
fails "Kernel#puts flattens a nested array before writing it"
fails "Kernel#puts ignores the $/ separator global"
@@ -201,6 +202,8 @@
fails "Kernel#remove_instance_variable when passed a Symbol returns the instance variable's value"
fails "Kernel#remove_instance_variable when passed an Object calls #to_str to convert the argument"
fails "Kernel#respond_to? does not change method visibility when finding private method"
fails "Kernel#respond_to? is a public method"
fails "Kernel#respond_to? is only an instance method"
fails "Kernel#respond_to? returns false even if obj responds to the given private method (include_private = false)"
fails "Kernel#respond_to? returns false if obj responds to the given private method"
fails "Kernel#respond_to? returns false if obj responds to the given protected method (include_private = false)"
@@ -218,6 +221,7 @@
fails "Kernel#respond_to_missing? is called with a 2nd argument of false when #respond_to? is"
fails "Kernel#respond_to_missing? is called with true as the second argument when #respond_to? is"
fails "Kernel#respond_to_missing? is not called when #respond_to? would return true"
fails "Kernel#respond_to_missing? is only an instance method"
fails "Kernel#respond_to_missing? isn't called when obj responds to the given private method, include_private = true"
fails "Kernel#respond_to_missing? isn't called when obj responds to the given protected method, include_private = true"
fails "Kernel#respond_to_missing? isn't called when obj responds to the given public method"
4 changes: 4 additions & 0 deletions spec/filters/bugs/module.rb
Original file line number Diff line number Diff line change
@@ -128,6 +128,8 @@
fails "Module#define_method passed { |a| } creates a method that raises an ArgumentError when passed zero arguments"
fails "Module#define_method passed { || } creates a method that raises an ArgumentError when passed one argument"
fails "Module#define_method passed { || } creates a method that raises an ArgumentError when passed two arguments"
fails "Module#define_method raises a TypeError when a Method from a singleton class is defined on another class"
fails "Module#define_method raises a TypeError when a Method from one class is defined on an unrelated class"
fails "Module#define_method raises a TypeError when an UnboundMethod from a child class is defined on a parent class"
fails "Module#define_method raises a TypeError when an UnboundMethod from one class is defined on an unrelated class"
fails "Module#extend_object does not copy own tainted status to the given object"
@@ -249,6 +251,7 @@
fails "Module#private_class_method raises a NameError when the given name is an instance method"
fails "Module#private_class_method raises a NameError when the given name is not a method"
fails "Module#private_constant accepts multiple names"
fails "Module#private_constant accepts strings as constant names"
fails "Module#private_constant can only be passed constant names defined in the target (self) module"
fails "Module#private_instance_methods returns a list of private methods in module and its ancestors"
fails "Module#private_instance_methods when not passed an argument returns a unique list for a class including a module"
@@ -310,6 +313,7 @@
fails "Module#public_class_method raises a NameError when the given name is an instance method"
fails "Module#public_class_method raises a NameError when the given name is not a method"
fails "Module#public_constant accepts multiple names"
fails "Module#public_constant accepts strings as constant names"
fails "Module#public_instance_method is a public method"
fails "Module#public_instance_method raises a TypeError when given a name is not Symbol or String"
fails "Module#public_instance_method requires an argument"
1 change: 1 addition & 0 deletions spec/filters/bugs/range.rb
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
fails "Range#bsearch with Integer values with a block returning true or false returns minimum element if the block returns true for every element"
fails "Range#bsearch with Integer values with a block returning true or false returns nil if the block returns false for every element"
fails "Range#bsearch with Integer values with a block returning true or false returns nil if the block returns nil for every element"
fails "Range#bsearch with Integer values with a block returning true or false returns the last element if the block returns true for the last element"
fails "Range#bsearch with Integer values with a block returning true or false returns the smallest element for which block returns true"
fails "Range#cover? compares values using <=>"
fails "Range#cover? returns false if range is empty"
2 changes: 2 additions & 0 deletions spec/filters/unsupported/array.rb
Original file line number Diff line number Diff line change
@@ -63,12 +63,14 @@
fails "Array#fill raises a RuntimeError on a frozen array"
fails "Array#fill raises a RuntimeError on an empty frozen array"
fails "Array#fill with (filler, index, length) raises an ArgumentError or RangeError for too-large sizes"
fails "Array#first raises a RangeError when count is a Bignum"
fails "Array#flatten returns a tainted array if self is tainted"
fails "Array#flatten returns an untrusted array if self is untrusted"
fails "Array#flatten! raises a RuntimeError on frozen arrays when the array is modified"
fails "Array#flatten! raises a RuntimeError on frozen arrays when the array would not be modified"
fails "Array#frozen? returns false for an array being sorted by #sort"
fails "Array#frozen? returns true if array is frozen"
fails "Array#hash returns the same fixnum for arrays with the same content"
fails "Array#initialize is private"
fails "Array#initialize raises a RuntimeError on frozen arrays"
fails "Array#initialize_copy is private"
2 changes: 1 addition & 1 deletion spec/rubyspec