summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/array-sort.js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-12-21 10:24:08 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-12-21 10:24:08 -0800
commit1a894b39b3c622e7c7d228c049e68b65e4334ee5 (patch)
treed115a78b28c3b1643154589473c74c75ed039fc7 /deps/v8/test/mjsunit/array-sort.js
parent6f726cf8c7415d58acb5f6b8493fe53f272b1dd4 (diff)
downloadnode-1a894b39b3c622e7c7d228c049e68b65e4334ee5.tar.gz
Upgrade V8 to 3.0.4
Diffstat (limited to 'deps/v8/test/mjsunit/array-sort.js')
-rw-r--r--deps/v8/test/mjsunit/array-sort.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/deps/v8/test/mjsunit/array-sort.js b/deps/v8/test/mjsunit/array-sort.js
index a082abcb1..7060c5f36 100644
--- a/deps/v8/test/mjsunit/array-sort.js
+++ b/deps/v8/test/mjsunit/array-sort.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -360,3 +360,18 @@ function TestSpecialCasesInheritedElementSort() {
}
TestSpecialCasesInheritedElementSort();
+
+// Test that sort calls compare function with global object as receiver,
+// and with only elements of the array as arguments.
+function o(v) {
+ return {__proto__: o.prototype, val: v};
+}
+var arr = [o(1), o(2), o(4), o(8), o(16), o(32), o(64), o(128), o(256), o(-0)];
+var global = this;
+function cmpTest(a, b) {
+ assertEquals(global, this);
+ assertTrue(a instanceof o);
+ assertTrue(b instanceof o);
+ return a.val - b.val;
+}
+arr.sort(cmpTest); \ No newline at end of file