| <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>S7.6_A2.1_T3</p> |
| <div id='console'></div> |
| <script> |
| try { |
| |
| /** |
| * @name: S7.6_A2.1_T3; |
| * @section: 7.6; |
| * @assertion: IdentifierPart :: IdentifierStart; |
| * @description: IdentifierStart :: _; |
| */ |
| |
| //CHECK#1 |
| try { |
| var identifier = "x" + "_"; |
| eval("var " + identifier + "=1"); |
| if (x_ !== 1) { |
| testFailed('#1.1: var identifier = "x" + "_"; eval("var " + identifier + "=1"); x_ === 1. Actual: ' + (x_)); |
| } |
| } catch (e) { |
| testFailed('#1.2: var identifier = "x" + "_"; eval("var " + identifier + "=1"); x_ === 1. Actual: ' + (x_)); |
| } |
| |
| //CHECK#2 |
| try { |
| var identifier = String.fromCharCode(0x0078) + "_"; |
| eval("var " + identifier + "=2"); |
| if (x_ !== 2) { |
| testFailed('#2.1: var identifier = String.fromCharCode(0x0078) + "_"; eval("var " + identifier + "=2"); x_ === 2. Actual: ' + (x_)); |
| } |
| } catch (e) { |
| testFailed('#2.2: var identifier = String.fromCharCode(0x0078) + "_"; eval("var " + identifier + "=2"); x_ === 2. Actual: ' + (x_)); |
| } |
| |
| //CHECK#3 |
| try { |
| var identifier = "_" + "_"; |
| eval("var " + identifier + "=3"); |
| if (__ !== 3) { |
| testFailed('#3.1: var identifier = "_" + "_"; eval("var " + identifier + "=3"); __ === 3. Actual: ' + (__)); |
| } |
| } catch (e) { |
| testFailed('#3.2: var identifier = "_" + "_"; eval("var " + identifier + "=3"); __ === 3. Actual: ' + (__)); |
| } |
| |
| //CHECK#4 |
| try { |
| var identifier = String.fromCharCode(0x005F) + String.fromCharCode(0x005F); |
| eval("var " + identifier + "=4"); |
| if (__ !== 4) { |
| testFailed('#4.1: var identifier = String.fromCharCode(0x005F) + String.fromCharCode(0x005F); eval("var " + identifier + "=4"); __ === 4. Actual: ' + (__)); |
| } |
| } catch (e) { |
| testFailed('#4.2: var identifier = String.fromCharCode(0x005F) + String.fromCharCode(0x005F); eval("var " + identifier + "=4"); __ === 4. Actual: ' + (__)); |
| } |
| |
| //CHECK#5 |
| try { |
| var identifier = "_" + "_"; |
| eval("var " + identifier + "=5"); |
| if (__ !== 5) { |
| testFailed('#5.1: var identifier = "_" + "_"; eval("var " + identifier + "=5"); __ === 5. Actual: ' + (__)); |
| } |
| } catch (e) { |
| testFailed('#5.2: var identifier = "_" + "_"; eval("var " + identifier + "=5"); __ === 5. Actual: ' + (__)); |
| } |
| |
| //CHECK#6 |
| try { |
| var \u0078_ = 6; |
| if (x_ !== 6) { |
| testFailed('#6.1: var \\u0078_ = 1; x_ === 6. Actual: ' + (x_)); |
| } |
| } catch (e) { |
| testFailed('#6.2: var \\u0078_ = 1; x_ === 6. Actual: ' + (x_)); |
| } |
| |
| } 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> |