| <html> |
| <head> |
| <meta charset='utf-8'> |
| <style> |
| .pass { |
| font-weight: bold; |
| color: green; |
| } |
| .fail { |
| font-weight: bold; |
| color: red; |
| } |
| </style> |
| |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function SputnikError(message) |
| { |
| this.message = message; |
| } |
| |
| SputnikError.prototype.toString = function () |
| { |
| return 'SputnikError: ' + this.message; |
| }; |
| |
| var sputnikException; |
| |
| function testPrint(msg) |
| { |
| var span = document.createElement("span"); |
| document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace |
| span.innerHTML = msg + '<br />'; |
| } |
| |
| function escapeHTML(text) |
| { |
| return text.toString().replace(/&/g, "&").replace(/</g, "<"); |
| } |
| |
| function printTestPassed(msg) |
| { |
| testPrint('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>'); |
| } |
| |
| function printTestFailed(msg) |
| { |
| testPrint('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>'); |
| } |
| |
| function testFailed(msg) |
| { |
| throw new SputnikError(msg); |
| } |
| |
| var successfullyParsed = false; |
| </script> |
| |
| </head> |
| <body> |
| <p>S13.2.2_A5_T1</p> |
| <div id='console'></div> |
| <script> |
| try { |
| |
| /** |
| * @name: S13.2.2_A5_T1; |
| * @section: 13.2.2; |
| * @assertion: When the [[Construct]] property for a Function object F is called: |
| * A new native ECMAScript object is created. |
| * Invoke the [[Call]] property of F, providing native ECMAScript object just created as the this value and |
| * providing the argument list passed into [[Construct]] as the argument values; |
| * @description: Declaring a function with "function __FACTORY(arg1, arg2)"; |
| */ |
| |
| __VOLUME=8; |
| __RED="red"; |
| __ID=12342; |
| __TOP=1.1; |
| __BOTTOM=0.0; |
| __LEFT=0.0; |
| |
| |
| function __FACTORY(arg1, arg2){ |
| this.volume=__VOLUME; |
| color=__RED; |
| this.id=arg1; |
| top=arg2; |
| this.bottom=arguments[3]; |
| left=arguments[4]; |
| }; |
| |
| __device = new __FACTORY(__ID, __TOP, __BOTTOM, __LEFT); |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| //CHECK#1 |
| if (__device.color !== undefined) { |
| testFailed('#1: __device.color === undefined. Actual: __device.color ==='+__device.color); |
| } |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| //CHECK#2 |
| if (__device.volume !== __VOLUME) { |
| testFailed('#2: __device.volume === __VOLUME. Actual: __device.volume ==='+__device.volume); |
| } |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| //CHECK#3 |
| if (__device.top !== undefined) { |
| testFailed('#3: __device.top === undefined. Actual: __device.top ==='+__device.top); |
| } |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| //CHECK#4 |
| if (__device.id !== __ID) { |
| testFailed('#4: __device.id === __ID. Actual: __device.id ==='+__device.id); |
| } |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| //CHECK#5 |
| if (__device.left !== undefined) { |
| testFailed('#5: __device.left === undefined. Actual: __device.left ==='+__device.left); |
| } |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| //CHECK#6 |
| if (__device.bottom !== __BOTTOM) { |
| testFailed('#6: __device.bottom === __BOTTOM. Actual: __device.bottom ==='+__device.bottom); |
| } |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| } catch (ex) { |
| sputnikException = ex; |
| } |
| |
| var successfullyParsed = true; |
| </script> |
| |
| <script> |
| if (!successfullyParsed) |
| printTestFailed('successfullyParsed is not set'); |
| else if (sputnikException) |
| printTestFailed(sputnikException); |
| else |
| printTestPassed(""); |
| testPrint('<br /><span class="pass">TEST COMPLETE</span>'); |
| </script> |
| </body> |
| </html> |