2011-02-07 James Robinson <jamesr@chromium.org>
[WebKit-https.git] / LayoutTests / sputnik / Conformance / 07_Lexical_Conventions / 7.8_Literals / 7.8.4_String_Literals / S7.8.4_A7.1_T1.html
1 <html>
2 <head>
3 <meta charset='utf-8'>
4 <style>
5 .pass {
6     font-weight: bold;
7     color: green;
8 }
9 .fail {
10     font-weight: bold;
11     color: red;
12 }
13 </style>
14
15 <script>
16 if (window.layoutTestController)
17     layoutTestController.dumpAsText();
18
19 function SputnikError(message)
20 {
21     this.message = message;
22 }
23
24 SputnikError.prototype.toString = function ()
25 {
26     return 'SputnikError: ' + this.message;
27 };
28
29 var sputnikException;
30
31 function testPrint(msg)
32 {
33     var span = document.createElement("span");
34     document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace 
35     span.innerHTML = msg + '<br />';
36 }
37
38 function escapeHTML(text)
39 {
40     return text.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;");
41 }
42
43 function printTestPassed(msg)
44 {
45     testPrint('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
46 }
47
48 function printTestFailed(msg)
49 {
50     testPrint('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
51 }
52
53 function testFailed(msg)
54 {
55     throw new SputnikError(msg);
56 }
57
58 var successfullyParsed = false;
59 </script>
60
61 </head>
62 <body>
63 <p>S7.8.4_A7.1_T1</p>
64 <div id='console'></div>
65 <script>
66 try {
67
68 /**
69  * @name: S7.8.4_A7.1_T1;
70  * @section: 7.8.4;
71  * @assertion: EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit HexDigit;
72  * @description: Check similar to ("\u0000" === String.fromCharCode("0"));
73 */
74
75 //CHECK#0
76 if ("\u0000" !== String.fromCharCode("0")) {
77   testFailed('#0: "\\u0000" === String.fromCharCode("0")');
78 }
79
80 //CHECK#1
81 if ("\u0001" !== String.fromCharCode("1")) {
82   testFailed('#1: "\\u0001" === String.fromCharCode("1")');
83 }
84
85 //CHECK#2
86 if ("\u0002" !== String.fromCharCode("2")) {
87   testFailed('#2: "\\u0002" === String.fromCharCode("2")');
88 }
89
90 //CHECK#3
91 if ("\u0003" !== String.fromCharCode("3")) {
92   testFailed('#3: "\\u0003" === String.fromCharCode("3")');
93 }
94
95 //CHECK#4
96 if ("\u0004" !== String.fromCharCode("4")) {
97   testFailed('#4: "\\u0004" === String.fromCharCode("4")');
98 }
99
100 //CHECK#5
101 if ("\u0005" !== String.fromCharCode("5")) {
102   testFailed('#5: "\\u0005" === String.fromCharCode("5")');
103 }
104
105 //CHECK#6
106 if ("\u0006" !== String.fromCharCode("6")) {
107   testFailed('#6: "\\u0006" === String.fromCharCode("6")');
108 }
109
110 //CHECK#7
111 if ("\u0007" !== String.fromCharCode("7")) {
112   testFailed('#7: "\\u0007" === String.fromCharCode("7")');
113 }
114
115 //CHECK#8
116 if ("\u0008" !== String.fromCharCode("8")) {
117   testFailed('#8: "\\u0008" === String.fromCharCode("8")');
118 }
119
120 //CHECK#9
121 if ("\u0009" !== String.fromCharCode("9")) {
122   testFailed('#9: "\\u0009" === String.fromCharCode("9")');
123 }
124
125 //CHECK#A
126 if ("\u000A" !== String.fromCharCode("10")) {
127   testFailed('#A: "\\u000A" === String.fromCharCode("10")');
128 }
129
130 //CHECK#B
131 if ("\u000B" !== String.fromCharCode("11")) {
132   testFailed('#B: "\\u000B" === String.fromCharCode("11")');
133 }
134
135 //CHECK#C
136 if ("\u000C" !== String.fromCharCode("12")) {
137   testFailed('#C: "\\u000C" === String.fromCharCode("12")');
138 }
139
140 //CHECK#D
141 if ("\u000D" !== String.fromCharCode("13")) {
142   testFailed('#D: "\\u000D" === String.fromCharCode("13")');
143 }
144
145 //CHECK#E
146 if ("\u000E" !== String.fromCharCode("14")) {
147   testFailed('#E: "\\u000E" === String.fromCharCode("14")');
148 }
149
150 //CHECK#F
151 if ("\u000F" !== String.fromCharCode("15")) {
152   testFailed('#F: "\\u000F" === String.fromCharCode("15")');
153 }
154
155 } catch (ex) {
156     sputnikException = ex;
157 }
158
159 var successfullyParsed = true;
160 </script>
161
162 <script>
163 if (!successfullyParsed)
164     printTestFailed('successfullyParsed is not set');
165 else if (sputnikException)
166     printTestFailed(sputnikException);
167 else
168     printTestPassed("");
169 testPrint('<br /><span class="pass">TEST COMPLETE</span>');
170 </script>
171 </body>
172 </html>