Author: Andrews Medina <[email protected]>
Branch: 
Changeset: r379:d3e475feac0c
Date: 2013-05-13 00:49 -0300
http://bitbucket.org/pypy/lang-js/changeset/d3e475feac0c/

Log:    fixed [].sort() and obj.put behaviour.

diff --git a/test/test_array.py b/test/test_array.py
--- a/test/test_array.py
+++ b/test/test_array.py
@@ -1,6 +1,12 @@
 from test.test_interp import assertv, assertp
 
 
+def test_sort(capsys):
+    assertp("var x = [5,2]; print(x.sort());", '2,5', capsys)
+    assertp("var x = [1,2,3]; print(x.sort());", '1,2,3', capsys)
+    assertp("var x = [4,3,2,1]; print(x.sort());", '1,2,3,4', capsys)
+
+
 def test_array_push(capsys):
     assertv("var x = []; x.push(42); x.length;", 1)
     assertv("var x = []; x.push(42); x[0];", 42)
diff --git a/test/test_w_array.py b/test/test_w_array.py
--- a/test/test_w_array.py
+++ b/test/test_w_array.py
@@ -3,6 +3,14 @@
 from js.object_space import _w
 
 
+def test_array_put_change_index():
+    a = W__Array()
+    a.put(u'0', 42)
+    assert a.get(u'0') == 42
+    a.put(u'0', 43)
+    assert a.get(u'0') == 43
+
+
 def test_array_get():
     a = W__Array()
     a._set_prop(u'23', DataProperty(42, True, True, True))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to