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: 058248dffef0
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 00d48c7b2168
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 27, 2013

  1. Copy the full SHA
    9b4ffe0 View commit details
  2. Copy the full SHA
    00d48c7 View commit details
Showing with 4 additions and 5 deletions.
  1. +4 −0 opal/corelib/array.rb
  2. +0 −5 spec/opal/filters/bugs/array.rb
4 changes: 4 additions & 0 deletions opal/corelib/array.rb
Original file line number Diff line number Diff line change
@@ -736,6 +736,8 @@ def fetch(index, defaults = undefined, &block)
%x{
var original = index;
index = #{Opal.coerce_to `index`, Integer, :to_int};
if (index < 0) {
index += self.length;
}
@@ -961,6 +963,8 @@ def index(object=undefined, &block)

def insert(index, *objects)
%x{
index = #{Opal.coerce_to `index`, Integer, :to_int};
if (objects.length > 0) {
if (index < 0) {
index += self.length + 1;
5 changes: 0 additions & 5 deletions spec/opal/filters/bugs/array.rb
Original file line number Diff line number Diff line change
@@ -39,9 +39,6 @@
fails "Array#== compares with an equivalent Array-like object using #to_ary"
fails "Array#== handles well recursive arrays"

fails "Array#fetch tries to convert the passed argument to an Integer using #to_int"
fails "Array#fetch raises a TypeError when the passed argument can't be coerced to Integer"

fails "Array#flatten does not call flatten on elements"
fails "Array#flatten raises an ArgumentError on recursive arrays"
fails "Array#flatten with a non-Array object in the Array ignores the return value of #to_ary if it is nil"
@@ -68,8 +65,6 @@
fails "Array#initialize with (array) calls #to_ary to convert the value to an array"
fails "Array#initialize preserves the object's identity even when changing its value"

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

fails "Array#join raises an ArgumentError when the Array is recursive"
fails "Array#join raises a NoMethodError if an element does not respond to #to_str, #to_ary, or #to_s"
fails "Array#join attempts coercion via #to_str first"