blob: 3a4ee8c4eb7e83fdbad75ef35caa9bccde74074e [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>S12.10_A1.10_T4</p>
<div id='console'></div>
<script>
try {
/**
* @name: S12.10_A1.10_T4;
* @section: 12.10;
* @assertion: The with statement adds a computed object to the front of the
* scope chain of the current execution context;
* @description: Using iteration statement witthin "with" staement leading to completion by break
* iteration statement inside with statement - break completion;
*/
this.p1 = 1;
this.p2 = 2;
this.p3 = 3;
var result = "result";
var myObj = {p1: 'a',
p2: 'b',
p3: 'c',
value: 'myObj_value',
valueOf : function(){return 'obj_valueOf';},
parseInt : function(){return 'obj_parseInt';},
NaN : 'obj_NaN',
Infinity : 'obj_Infinity',
eval : function(){return 'obj_eval';},
parseFloat : function(){return 'obj_parseFloat';},
isNaN : function(){return 'obj_isNaN';},
isFinite : function(){return 'obj_isFinite';}
}
var del;
var st_p1 = "p1";
var st_p2 = "p2";
var st_p3 = "p3";
var st_parseInt = "parseInt";
var st_NaN = "NaN";
var st_Infinity = "Infinity";
var st_eval = "eval";
var st_parseFloat = "parseFloat";
var st_isNaN = "isNaN";
var st_isFinite = "isFinite";
with(myObj){
do{
st_p1 = p1;
st_p2 = p2;
st_p3 = p3;
st_parseInt = parseInt;
st_NaN = NaN;
st_Infinity = Infinity;
st_eval = eval;
st_parseFloat = parseFloat;
st_isNaN = isNaN;
st_isFinite = isFinite;
p1 = 'x1';
this.p2 = 'x2';
del = delete p3;
var p4 = 'x4';
p5 = 'x5';
var value = 'value';
break;
}
while(false);
}
if(!(p1 === 1)){
testFailed('#1: p1 === 1. Actual: p1 ==='+ p1 );
}
if(!(p2 === "x2")){
testFailed('#2: p2 === "x2". Actual: p2 ==='+ p2 );
}
if(!(p3 === 3)){
testFailed('#3: p3 === 3. Actual: p3 ==='+ p3 );
}
if(!(p4 === "x4")){
testFailed('#4: p4 === "x4". Actual: p4 ==='+ p4 );
}
if(!(p5 === "x5")){
testFailed('#5: p5 === "x5". Actual: p5 ==='+ p5 );
}
if(!(myObj.p1 === "x1")){
testFailed('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
}
if(!(myObj.p2 === "b")){
testFailed('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
}
if(!(myObj.p3 === undefined)){
testFailed('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
}
if(!(myObj.p4 === undefined)){
testFailed('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
}
if(!(myObj.p5 === undefined)){
testFailed('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
}
if(!(st_parseInt !== parseInt)){
testFailed('#11: myObj.parseInt !== parseInt');
}
if(!(st_NaN === "obj_NaN")){
testFailed('#12: myObj.NaN !== NaN');
}
if(!(st_Infinity !== Infinity)){
testFailed('#13: myObj.Infinity !== Infinity');
}
if(!(st_eval !== eval)){
testFailed('#14: myObj.eval !== eval');
}
if(!(st_parseFloat !== parseFloat)){
testFailed('#15: myObj.parseFloat !== parseFloat');
}
if(!(st_isNaN !== isNaN)){
testFailed('#16: myObj.isNaN !== isNaN');
}
if(!(st_isFinite !== isFinite)){
testFailed('#17: myObj.isFinite !== isFinite');
}
if(!(value === undefined)){
testFailed('#18: value === undefined. Actual: value ==='+ value );
}
if(!(myObj.value === "value")){
testFailed('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
}
} 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>