|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 //----------------------------------------------------------------------------- |
|
7 var BUGNUMBER = 387501; |
|
8 var summary = |
|
9 'Array.prototype.toString|toLocaleString are generic, ' + |
|
10 'Array.prototype.toSource is not generic'; |
|
11 var actual = ''; |
|
12 var expect = ''; |
|
13 |
|
14 |
|
15 //----------------------------------------------------------------------------- |
|
16 test(); |
|
17 //----------------------------------------------------------------------------- |
|
18 |
|
19 function test() |
|
20 { |
|
21 enterFunc ('test'); |
|
22 printBugNumber(BUGNUMBER); |
|
23 printStatus (summary); |
|
24 |
|
25 expect = '[object String]'; |
|
26 actual = Array.prototype.toString.call((new String('foo'))); |
|
27 assertEq(actual, expect, summary); |
|
28 |
|
29 expect = 'f,o,o'; |
|
30 actual = Array.prototype.toLocaleString.call((new String('foo'))); |
|
31 assertEq(actual, expect, summary); |
|
32 |
|
33 if (typeof Array.prototype.toSource != 'undefined') |
|
34 { |
|
35 try |
|
36 { |
|
37 Array.prototype.toSource.call(new String('foo')); |
|
38 throw new Error("didn't throw"); |
|
39 } |
|
40 catch(ex) |
|
41 { |
|
42 assertEq(ex instanceof TypeError, true, |
|
43 "wrong error thrown: expected TypeError, got " + ex); |
|
44 } |
|
45 } |
|
46 |
|
47 reportCompare(true, true, "Tests complete"); |
|
48 |
|
49 exitFunc ('test'); |
|
50 } |