Debian Codegraph @

rhino/testsrc/tests/ecma_3/Array/regress-387501.js

raw symbols SCIP
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 var gTestfile = 'regress-387501.js';
7
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 387501;
10 var summary = 'Array.prototype.toString|toSource|toLocaleString 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 try
26 {
27 expect = 'TypeError: Array.prototype.toString called on incompatible String';
28 actual = Array.prototype.toString.call((new String('foo')));
29 }
30 catch(ex)
31 {
32 actual = ex + '';
33 }
34 reportCompare(expect, actual, summary);
35
36 try
37 {
38 expect = 'TypeError: Array.prototype.toLocaleString called on incompatible String';
39 actual = Array.prototype.toLocaleString.call((new String('foo')));
40 }
41 catch(ex)
42 {
43 actual = ex + '';
44 }
45 reportCompare(expect, actual, summary);
46
47 if (typeof Array.prototype.toSource != 'undefined')
48 {
49 try
50 {
51 expect = 'TypeError: Array.prototype.toSource called on incompatible String';
52 actual = Array.prototype.toSource.call((new String('foo')));
53 }
54 catch(ex)
55 {
56 actual = ex + '';
57 }
58 reportCompare(expect, actual, summary);
59 }
60
61 exitFunc ('test');
62 }