blob: 3879b5d617630e27c1ba8f042c3c50f8d8db69e1 [file] [log] [blame]
<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, "&amp;").replace(/</g, "&lt;");
}
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_T1</p>
<div id='console'></div>
<script>
try {
/**
* @name: S7.6_A2.1_T1;
* @section: 7.6;
* @assertion: IdentifierPart :: IdentifierStart;
* @description: IdentifierStart :: UnicodeLetter;
*/
//CHECK#1
try {
var identifier = "x" + "x";
eval("var " + identifier + "=1");
if (xx !== 1) {
testFailed('#1.1: var identifier = "x" + "x"; eval("var " + identifier + "=1"); xx === 1. Actual: ' + (xx));
}
} catch (e) {
testFailed('#1.2: var identifier = "x" + "x"; eval("var " + identifier + "=1"); xx === 1. Actual: ' + (xx));
}
//CHECK#2
try {
var identifier = "x" + String.fromCharCode(0x0078);
eval("var " + identifier + "=2");
if (xx !== 2) {
testFailed('#2.1: var identifier = "x" + String.fromCharCode(0x0078); eval("var " + identifier + "=2"); xx === 2. Actual: ' + (xx));
}
} catch (e) {
testFailed('#2.2: var identifier = "x" + String.fromCharCode(0x0078); eval("var " + identifier + "=2"); xx === 2. Actual: ' + (xx));
}
//CHECK#3
try {
var identifier = String.fromCharCode(0x0078) + String.fromCharCode(0x0078);
eval("var " + identifier + "=3");
if (xx !== 3) {
testFailed('#3.1: var identifier = String.fromCharCode(0x0078) + String.fromCharCode(0x0078); eval("var " + identifier + "=3"); xx === 3. Actual: ' + (xx));
}
} catch (e) {
testFailed('#3.2: var identifier = String.fromCharCode(0x0078) + String.fromCharCode(0x0078); eval("var " + identifier + "=3"); xx === 3. Actual: ' + (xx));
}
//CHECK#4
try {
var identifier = "$" + String.fromCharCode(0x0078);
eval("var " + identifier + "=4");
if ($x !== 4) {
testFailed('#4.1: var identifier = "$" + String.fromCharCode(0x0078); eval("var " + identifier + "=4"); $x === 4. Actual: ' + ($x));
}
} catch (e) {
testFailed('#4.2: var identifier = "$" + String.fromCharCode(0x0078); eval("var " + identifier + "=4"); $x === 4. Actual: ' + ($x));
}
//CHECK#5
try {
var identifier = "_" + String.fromCharCode(0x0078);
eval("var " + identifier + "=5");
if (_x !== 5) {
testFailed('#5.1: var identifier = "_" + String.fromCharCode(0x0078); eval("var " + identifier + "=5"); _x === 5. Actual: ' + (_x));
}
} catch (e) {
testFailed('#5.2: var identifier = "_" + String.fromCharCode(0x0078); eval("var " + identifier + "=5"); _x === 5. Actual: ' + (_x));
}
//CHECK#6
try {
var \u0078x = 6;
if (xx !== 6) {
testFailed('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx));
}
} catch (e) {
testFailed('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx));
}
} 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>