blob: b2cf8718fdeff00b62ff36723820a4a901e0200d [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>S11.4.3_A3.6</p>
<div id='console'></div>
<script>
try {
/**
* @name: S11.4.3_A3.6;
* @section: 11.4.3;
* @assertion: Result of applying "typeof" operator to the object that is native and doesn't implement [[Call]] is "object";
* @description: typeof (object without [[Call]]) === "object";
*/
//CHECK#1
if (typeof this !== "object") {
testFailed('#1: typeof this === "object". Actual: ' + (typeof this));
}
//CHECK#2
if (typeof new Object() !== "object") {
testFailed('#2: typeof new Object() === "object". Actual: ' + (typeof new Object()));
}
//CHECK#3
if (typeof new Array(1,2,3) !== "object") {
testFailed('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3)));
}
//CHECK#4
if (typeof Array(1,2,3) !== "object") {
testFailed('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3)));
}
//CHECK#5
if (typeof new String("x") !== "object") {
testFailed('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x")));
}
//CHECK#6
if (typeof new Boolean(true) !== "object") {
testFailed('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true)));
}
//CHECK#7
if (typeof new Number(1) !== "object") {
testFailed('#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1)));
}
//CHECK#8
//The Math object does not have a [[Construct]] property;
//it is not possible to use the Math object as a constructor with the new operator.
//The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a object.
if (typeof Math !== "object") {
testFailed('#8: typeof Math === "object". Actual: ' + (typeof Math));
}
//CHECK#9
if (typeof new Date() !== "object") {
testFailed('#9: typeof new Date() === "object". Actual: ' + (typeof new Date()));
}
//CHECK#10
if (typeof new Error() !== "object") {
testFailed('#10: typeof new Error() === "object". Actual: ' + (typeof new Error()));
}
//CHECK#11
if (typeof new RegExp() !== "object") {
testFailed('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp()));
}
//CHECK#12
if (typeof RegExp() !== "object") {
testFailed('#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp()));
}
} 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>