2 "Test of array sort with toString() override that throws exception."
7 var exceptionString
= 'From toString()';
10 var a
= new Array(size
);
13 if (window
.GCController
)
14 return GCController
.collect();
16 for (var i
= 0; i
< 1000; i
++)
24 function toString_throw() {
25 var s
= this.value
.toString();
27 if (this.value
>= size
/2)
28 throw(exceptionString
);
30 s
= ('0000' + s
).slice(-digits
);
36 for (var i
= 0; i
< a
.length
; i
++) {
37 a
[i
] = new Item(a
.length
- i
- 1);
38 a
[i
].toString
= toString_throw
;
45 shouldBe("catchArg", "exceptionString");
52 debug('ERROR: Never got toString() exception');