New layout tests for the bugs I just fixed.
[WebKit-https.git] / LayoutTests / fast / js / char-at.html
1 <script>
2
3 function test() {
4
5     var undefined;
6
7     var cases = [
8         ["", "omitted"],
9         ["", undefined],
10         ["", 0],
11         ["", null],
12         ["", false],
13         ["", true],
14         ["", 0.0],
15         ["", 0.1],
16         ["", 999],
17         ["", 1/0],
18         ["", -1],
19         ["", -1/0],
20         ["", 0/0],
21
22         ["x", "omitted"],
23         ["x", undefined],
24         ["x", 0],
25         ["x", null],
26         ["x", false],
27         ["x", true],
28         ["x", 0.0],
29         ["x", 0.1],
30         ["x", 999],
31         ["x", 1/0],
32         ["x", -1],
33         ["x", -1/0],
34         ["x", 0/0],
35
36         ["xy", "omitted"],
37         ["xy", undefined],
38         ["xy", 0],
39         ["xy", null],
40         ["xy", false],
41         ["xy", true],
42         ["xy", 0.0],
43         ["xy", 0.1],
44         ["xy", 999],
45         ["xy", 1/0],
46         ["xy", -1],
47         ["xy", -1/0],
48         ["xy", 0/0],
49     ];
50
51     for (var i = 0; i < cases.length; ++i)
52     {
53         var item = cases[i];
54         if (item[1] == "omitted") {
55             var string = item[0].charAt();
56             var code = item[0].charCodeAt();
57         } else {
58             var string = item[0].charAt(item[1]);
59             var code = item[0].charCodeAt(item[1]);
60         }
61
62         var item0String = item[0];
63         if (typeof item0String == "string")
64             item0String = '"' + item0String + '"';
65         var item1String = item[1];
66         if (typeof item1String == "string" && item[1] != "omitted")
67             item1String = '"' + item1String + '"';
68         var message = item0String + ', ' + item1String + ': "' + string + '", ' + code;
69
70         var div = document.createElement('div');
71         div.innerHTML = message;
72         document.body.appendChild(div);
73     }
74
75 }
76
77 </script>
78
79 <body onload="test()">
80 </body>