Skip to content
Permalink
Browse files

Merge 21bba2e into 879e92b

  • Loading branch information
timfel committed Jul 21, 2013
2 parents 879e92b + 21bba2e commit 77bc11353b517eb96c17d8324c2f8fda306a9071
Showing with 334 additions and 56 deletions.
  1. +11 −0 tests/objects/test_arrayobject.py
  2. +6 −0 tests/objects/test_rangeobject.py
  3. +316 −55 topaz/objects/arrayobject.py
  4. +1 −1 topaz/objspace.py
@@ -203,6 +203,17 @@ def test_dup(self, space):
assert x == [1, 2, 3, 4]
assert y == [1, 2, 3]

def test_dupf(self, space):
w_res = space.execute("""
x = [1.0, 2.0, 3.0]
y = x.dup
x << 4
return [x, y]
""")
x, y = self.unwrap(space, w_res)
assert x == [1.0, 2.0, 3.0, 4]
assert y == [1.0, 2.0, 3.0]

def test_compact(self, space):
w_res = space.execute("return ['a', nil, 'b', nil, 'c'].compact")
assert self.unwrap(space, w_res) == ['a', 'b', 'c']
@@ -84,3 +84,9 @@ def test_each_returns_self(self, space):
return r.each {}.equal?(r)
""")
assert w_res is space.w_true

def test_array_conversion(self, space):
w_res = space.execute("""
return (1..4).to_a
""")
assert self.unwrap(space, w_res) == [1, 2, 3, 4]

0 comments on commit 77bc113

Please sign in to comment.