js/src/tests/test262/ch13/13.2/S13.2.1_A5_T1.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:f8228f4648fb
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /**
5 * Closures are admitted
6 *
7 * @path ch13/13.2/S13.2.1_A5_T1.js
8 * @description Sorting with closure
9 */
10
11 var __arr = [4,3,2,1,4,3,2,1,4,3,2,1];
12 //Sort uses closure
13 //
14 __arr.sort(
15 function(x,y) {
16 if (x>y){return -1;}
17 if (x<y){return 1;}
18 if (x==y){return 0;}
19 }
20 );
21
22 //////////////////////////////////////////////////////////////////////////////
23 //CHECK#1
24 if (__arr.toString() !== [4,4,4,3,3,3,2,2,2,1,1,1].toString()) {
25 $ERROR('#1: __arr.toString() === [4,4,4,3,3,3,2,2,2,1,1,1].toString(). Actual: __arr.toString() ==='+__arr.toString());
26 }
27
28 //
29 //////////////////////////////////////////////////////////////////////////////
30

mercurial