Debian Codegraph @

rhino/testsrc/tests/js1_6/String/regress-306591.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-306591.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 306591;
9 var summary = 'String static methods';
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15 printStatus ('See https://bugzilla.mozilla.org/show_bug.cgi?id=304828');
16
17 expect = ['a', 'b', 'c'].toString();
18 actual = String.split(new String('abc'), '').toString();
19 reportCompare(expect, actual, summary +
20 " String.split(new String('abc'), '')");
21
22 expect = '2';
23 actual = String.substring(new Number(123), 1, 2);
24 reportCompare(expect, actual, summary +
25 " String.substring(new Number(123), 1, 2)");
26
27 expect = 'TRUE';
28 actual = String.toUpperCase(new Boolean(true));
29 reportCompare(expect, actual, summary +
30 " String.toUpperCase(new Boolean(true))");
31
32 // null means the global object is passed
33 expect = (typeof window == 'undefined') ? 9 : -1;
34 actual = String.indexOf(null, 'l');
35 reportCompare(expect, actual, summary +
36 " String.indexOf(null, 'l')");
37
38 expect = 2;
39 actual = String.indexOf(String(null), 'l');
40 reportCompare(expect, actual, summary +
41 " String.indexOf(String(null), 'l')");
42
43 expect = ['a', 'b', 'c'].toString();
44 actual = String.split('abc', '').toString();
45 reportCompare(expect, actual, summary +
46 " String.split('abc', '')");
47
48 expect = '2';
49 actual = String.substring(123, 1, 2);
50 reportCompare(expect, actual, summary +
51 " String.substring(123, 1, 2)");
52
53 expect = 'TRUE';
54 actual = String.toUpperCase(true);
55 reportCompare(expect, actual, summary +
56 " String.toUpperCase(true)");
57
58 // null means the global object is passed
59 expect = (typeof window == 'undefined') ? -1 : 11;
60 actual = String.indexOf(undefined, 'd');
61 reportCompare(expect, actual, summary +
62 " String.indexOf(undefined, 'd')");
63
64 expect = 2;
65 actual = String.indexOf(String(undefined), 'd');
66 reportCompare(expect, actual, summary +
67 " String.indexOf(String(undefined), 'd')");