StringObjectUse should not be a structure check for the original string object structure
[WebKit-https.git] / LayoutTests / sputnik / Conformance / 08_Types / 8.1_The_Undefined_Type / S8.1_A2_T2.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.testRunner)
17     testRunner.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>S8.1_A2_T2</p>
64 <div id='console'></div>
65 <script>
66 try {
67
68 /**
69  * @name: S8.1_A2_T2;
70  * @section: 8.1;
71  * @assertion: Any variable that has not been assigned a value has the value undefined;
72  * @description: Function return undefined;
73 */
74
75 // CHECK#1
76 function test1(x) {
77         return x;
78 }
79
80 if (!(test1() === void 0)) {
81   testFailed('#1: function test1(x){return x} test1() === void 0. Actual: ' + (test1()));
82 }
83
84 // CHECK#2
85 function test2() {  
86 }
87
88 if (!(test2() === void 0)) {
89   testFailed('#2: function test2(){} test2() === void 0. Actual: ' + (test2()));
90 }
91
92 } catch (ex) {
93     sputnikException = ex;
94 }
95
96 var successfullyParsed = true;
97 </script>
98
99 <script>
100 if (!successfullyParsed)
101     printTestFailed('successfullyParsed is not set');
102 else if (sputnikException)
103     printTestFailed(sputnikException);
104 else
105     printTestPassed("");
106 testPrint('<br /><span class="pass">TEST COMPLETE</span>');
107 </script>
108 </body>
109 </html>