blob: 08023c74cf88389b985c61632aa545787e6f35c5 [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>S15.4.4.12_D1.5_T2</p>
<div id='console'></div>
<script>
try {
/**
* @name: S15.4.4.12_D1.5_T2;
* @section: 15.4.4.12;
* @assertion: If a function is given fewer arguments than the function is
* specified to require, the function shall behave exactly as if it had been
* given sufficient additional arguments, each such argument being the
* undefined value;
* @description: one argument;
*/
var x = [0,1,2,3];
var arr = x.splice(1);
//CHECK#1
arr.getClass = Object.prototype.toString;
if (arr.getClass() !== "[object " + "Array" + "]") {
testFailed('#1: var x = [0,1,2,3]; var arr = x.splice(1); arr is Array object');
}
//CHECK#2
if (arr.length !== 0) {
testFailed('#2: var x = [0,1,2,3]; var arr = x.splice(1); arr.length === 0');
}
//CHECK#3
if (x.length !== 4) {
testFailed('#3: var x = [0,1,2,3]; var arr = x.splice(1); x.length === 4');
}
//CHECK#4
if (x[0] !== 0) {
testFailed('#4: var x = [0,1,2,3]; var arr = x.splice(1); x[0] === 0');
}
//CHECK#5
if (x[1] !== 1) {
testFailed('#5: var x = [0,1,2,3]; var arr = x.splice(1); x[1] === 1');
}
//CHECK#6
if (x[2] !== 2) {
testFailed('#6: var x = [0,1,2,3]; var arr = x.splice(1); x[2] === 2');
}
//CHECK#7
if (x[3] !== 3) {
testFailed('#7: var x = [0,1,2,3]; var arr = x.splice(1); x[3] === 3');
}
} 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>