2011-02-07 James Robinson <jamesr@chromium.org>
[WebKit-https.git] / LayoutTests / sputnik / Conformance / 07_Lexical_Conventions / 7.4_Comments / S7.4_A1_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.4_A1_T1</p>
64 <div id='console'></div>
65 <script>
66 try {
67
68 /**
69  * @name: S7.4_A1_T1;
70  * @section: 7.4;
71  * @assertion: Correct interpretation of single line comments;
72  * @description: Create comments with any code;  
73 */
74
75 //CHECK#1
76 // testFailed('#1: Correct interpretation single line comments');
77
78 //CHECK#2
79 var x = 0;
80 // x = 1;
81 if (x !== 0) {
82   testFailed('#2: var x = 0; // x = 1; x === 0. Actual: ' + (x));
83 }
84
85 //CHECK#3
86 var // y = 1; 
87 y;
88 if (y !== undefined) {
89   testFailed('#3: var // y = 1; \\n y; y === undefined. Actual: ' + (y));
90 }  
91
92 //CHECK#4
93 //testFailed('#4: Correct interpretation single line comments') //testFailed('#4: Correct interpretation single line comments'); //
94
95 ////CHECK#5
96 //var x = 1;
97 //if (x === 1) {
98 //  testFailed('#5: Correct interpretation single line comments');
99 //}
100
101 //CHECK#6
102 //var this.y = 1; 
103 this.y++;
104 if (isNaN(y) !== true) {
105   testFailed('#6: //var this.y = 1; \\n this.y++; y === Not-a-Number. Actual: ' + (y));
106 }
107
108
109 } catch (ex) {
110     sputnikException = ex;
111 }
112
113 var successfullyParsed = true;
114 </script>
115
116 <script>
117 if (!successfullyParsed)
118     printTestFailed('successfullyParsed is not set');
119 else if (sputnikException)
120     printTestFailed(sputnikException);
121 else
122     printTestPassed("");
123 testPrint('<br /><span class="pass">TEST COMPLETE</span>');
124 </script>
125 </body>
126 </html>