Update tests to use assertion library

This commit is contained in:
Mike Pennisi 2015-04-07 17:05:55 -04:00
parent 663f6776aa
commit 3dce857e32
11 changed files with 273 additions and 218 deletions

View File

@ -8,17 +8,20 @@ es6id: 12.5.6.1
description: typeof (boolean value) === "boolean"
---*/
//CHECK#1
if (typeof true !== "boolean") {
$ERROR('#1: typeof true === "boolean". Actual: ' + (typeof true));
}
assert.sameValue(
typeof true,
"boolean",
'#1: typeof true === "boolean". Actual: ' + (typeof true)
);
//CHECK#2
if (typeof false !== "boolean") {
$ERROR('#2: typeof false === "boolean". Actual: ' + (typeof false));
}
assert.sameValue(
typeof false,
"boolean",
'#2: typeof false === "boolean". Actual: ' + (typeof false)
);
//CHECK#3
if (typeof !-1 !== "boolean") {
$ERROR('#3: typeof !-1 === "boolean". Actual: ' + (typeof !-1));
}
assert.sameValue(
typeof !-1,
"boolean",
'#3: typeof !-1 === "boolean". Actual: ' + (typeof !-1)
);

View File

@ -10,10 +10,14 @@ es6id: 12.5.6.1
description: Checking types of parseInt and Math.exp
---*/
//CHECK#1
if(typeof(Math.exp)!=="function")
$ERROR('#1: typeof(Math.exp)!=="function" '+typeof(Math.exp));
assert.sameValue(
typeof(Math.exp),
"function",
'#1: typeof(Math.exp)!=="function" '+typeof(Math.exp)
);
//CHECK#2
if(typeof(parseInt)!=="function")
$ERROR('#2: typeof(parseInt)!=="function" '+typeof(parseInt));
assert.sameValue(
typeof(parseInt),
"function",
'#2: typeof(parseInt)!=="function" '+typeof(parseInt)
);

View File

@ -8,19 +8,22 @@ es6id: 12.5.6.1
description: Either Type(x) is not Reference or GetBase(x) is not null
---*/
//CHECK#1
if (typeof 0 !== "number") {
$ERROR('#1: typeof 0 === "number". Actual: ' + (typeof 0));
}
assert.sameValue(
typeof 0,
"number",
'#1: typeof 0 === "number". Actual: ' + (typeof 0)
);
//CHECK#2
var x = 0;
if (typeof x !== "number") {
$ERROR('#2: typeof x === "number". Actual: ' + (typeof x));
}
assert.sameValue(
typeof x,
"number",
'#2: typeof x === "number". Actual: ' + (typeof x)
);
//CHECK#3
var x = new Object();
if (typeof x !== "object") {
$ERROR('#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x));
}
assert.sameValue(
typeof x,
"object",
'#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x)
);

View File

@ -10,47 +10,56 @@ es6id: 12.5.6.1
description: typeof (object with [[Call]]) === "function"
---*/
//CHECK#1
if (typeof new Function() !== "function") {
$ERROR('#1: typeof new Function() === "function". Actual: ' + (typeof new Function()));
}
assert.sameValue(
typeof new Function(),
"function",
'#1: typeof new Function() === "function". Actual: ' + (typeof new Function())
);
//CHECK#2
if (typeof Function() !== "function") {
$ERROR('#2: typeof Function() === "function". Actual: ' + (typeof Function()));
}
assert.sameValue(
typeof Function(),
"function",
'#2: typeof Function() === "function". Actual: ' + (typeof Function())
);
//CHECK#3
if (typeof Object !== "function") {
$ERROR('#3: typeof Object === "function". Actual: ' + (typeof Object));
}
assert.sameValue(
typeof Object,
"function",
'#3: typeof Object === "function". Actual: ' + (typeof Object)
);
//CHECK#4
if (typeof String !== "function") {
$ERROR('#4: typeof String === "function". Actual: ' + (typeof String));
}
assert.sameValue(
typeof String,
"function",
'#4: typeof String === "function". Actual: ' + (typeof String)
);
//CHECK5
if (typeof Boolean !== "function") {
$ERROR('#5: typeof Boolean === "function". Actual: ' + (typeof Boolean));
}
assert.sameValue(
typeof Boolean,
"function",
'#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)
);
//CHECK#6
if (typeof Number !== "function") {
$ERROR('#6: typeof Number === "function". Actual: ' + (typeof Number));
}
assert.sameValue(
typeof Number,
"function",
'#6: typeof Number === "function". Actual: ' + (typeof Number)
);
//CHECK#7
if (typeof Date !== "function") {
$ERROR('#7: typeof Date === "function". Actual: ' + (typeof Date));
}
assert.sameValue(
typeof Date,
"function",
'#7: typeof Date === "function". Actual: ' + (typeof Date)
);
//CHECK#8
if (typeof Error !== "function") {
$ERROR('#8: typeof Error === "function". Actual: ' + (typeof Error));
}
assert.sameValue(
typeof Error,
"function",
'#8: typeof Error === "function". Actual: ' + (typeof Error)
);
//CHECK#9
if (typeof RegExp !== "function") {
$ERROR('#9: typeof RegExp === "function". Actual: ' + (typeof RegExp));
}
assert.sameValue(
typeof RegExp,
"function",
'#9: typeof RegExp === "function". Actual: ' + (typeof RegExp)
);

View File

@ -10,65 +10,77 @@ es6id: 12.5.6.1
description: typeof (object without [[Call]]) === "object"
---*/
//CHECK#1
if (typeof this !== "object") {
$ERROR('#1: typeof this === "object". Actual: ' + (typeof this));
}
assert.sameValue(
typeof this,
"object",
'#1: typeof this === "object". Actual: ' + (typeof this)
);
//CHECK#2
if (typeof new Object() !== "object") {
$ERROR('#2: typeof new Object() === "object". Actual: ' + (typeof new Object()));
}
assert.sameValue(
typeof new Object(),
"object",
'#2: typeof new Object() === "object". Actual: ' + (typeof new Object())
);
//CHECK#3
if (typeof new Array(1,2,3) !== "object") {
$ERROR('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3)));
}
assert.sameValue(
typeof new Array(1,2,3),
"object",
'#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))
);
//CHECK#4
if (typeof Array(1,2,3) !== "object") {
$ERROR('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3)));
}
assert.sameValue(
typeof Array(1,2,3),
"object",
'#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))
);
//CHECK#5
if (typeof new String("x") !== "object") {
$ERROR('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x")));
}
assert.sameValue(
typeof new String("x"),
"object",
'#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))
);
//CHECK#6
if (typeof new Boolean(true) !== "object") {
$ERROR('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true)));
}
assert.sameValue(
typeof new Boolean(true),
"object",
'#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))
);
//CHECK#7
if (typeof new Number(1) !== "object") {
$ERROR('#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1)));
}
assert.sameValue(
typeof new Number(1),
"object",
'#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") {
$ERROR('#8: typeof Math === "object". Actual: ' + (typeof Math));
}
assert.sameValue(
typeof Math,
"object",
'#8: typeof Math === "object". Actual: ' + (typeof Math)
);
//CHECK#9
if (typeof new Date() !== "object") {
$ERROR('#9: typeof new Date() === "object". Actual: ' + (typeof new Date()));
}
assert.sameValue(
typeof new Date(),
"object",
'#9: typeof new Date() === "object". Actual: ' + (typeof new Date())
);
//CHECK#10
if (typeof new Error() !== "object") {
$ERROR('#10: typeof new Error() === "object". Actual: ' + (typeof new Error()));
}
assert.sameValue(
typeof new Error(),
"object",
'#10: typeof new Error() === "object". Actual: ' + (typeof new Error())
);
//CHECK#11
if (typeof new RegExp() !== "object") {
$ERROR('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp()));
}
assert.sameValue(
typeof new RegExp(),
"object",
'#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())
);
//CHECK#12
if (typeof RegExp() !== "object") {
$ERROR('#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp()));
}
assert.sameValue(
typeof RegExp(),
"object",
'#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp())
);

View File

@ -8,12 +8,14 @@ es6id: 12.5.6.1
description: typeof null === "object"
---*/
//CHECK#1
if (typeof null !== "object") {
$ERROR('#1: typeof null === "object". Actual: ' + (typeof null));
}
assert.sameValue(
typeof null,
"object",
'#1: typeof null === "object". Actual: ' + (typeof null)
);
//CHECK#2
if (typeof RegExp("0").exec("1") !== "object") {
$ERROR('#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (typeof RegExp("0").exec("1")));
}
assert.sameValue(
typeof RegExp("0").exec("1"),
"object",
'#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (typeof RegExp("0").exec("1"))
);

View File

@ -8,27 +8,32 @@ es6id: 12.5.6.1
description: typeof (number value) === "number"
---*/
//CHECK#1
if (typeof 1 !== "number") {
$ERROR('#1: typeof 1 === "number". Actual: ' + (typeof 1));
}
assert.sameValue(
typeof 1,
"number",
'#1: typeof 1 === "number". Actual: ' + (typeof 1)
);
//CHECK#2
if (typeof Number.NaN !== "number") {
$ERROR('#2: typeof NaN === "number". Actual: ' + (typeof NaN));
}
assert.sameValue(
typeof Number.NaN,
"number",
'#2: typeof NaN === "number". Actual: ' + (typeof NaN)
);
//CHECK#3
if (typeof Number.POSITIVE_INFINITY !== "number") {
$ERROR('#3: typeof Infinity === "number". Actual: ' + (typeof Infinity));
}
assert.sameValue(
typeof Number.POSITIVE_INFINITY,
"number",
'#3: typeof Infinity === "number". Actual: ' + (typeof Infinity)
);
//CHECK#4
if (typeof Number.NEGATIVE_INFINITY !== "number") {
$ERROR('#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity));
}
assert.sameValue(
typeof Number.NEGATIVE_INFINITY,
"number",
'#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity)
);
//CHECK#5
if (typeof Math.PI !== "number") {
$ERROR('#5: typeof Math.PI === "number". Actual: ' + (typeof Math.PI));
}
assert.sameValue(
typeof Math.PI,
"number",
'#5: typeof Math.PI === "number". Actual: ' + (typeof Math.PI)
);

View File

@ -8,32 +8,38 @@ es6id: 12.5.6.1
description: typeof (string value) === "string"
---*/
//CHECK#1
if (typeof "1" !== "string") {
$ERROR('#1: typeof "1" === "string". Actual: ' + (typeof "1"));
}
assert.sameValue(
typeof "1",
"string",
'#1: typeof "1" === "string". Actual: ' + (typeof "1")
);
//CHECK#2
if (typeof "NaN" !== "string") {
$ERROR('#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN"));
}
assert.sameValue(
typeof "NaN",
"string",
'#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")
);
//CHECK#3
if (typeof "Infinity" !== "string") {
$ERROR('#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity"));
}
assert.sameValue(
typeof "Infinity",
"string",
'#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")
);
//CHECK#4
if (typeof "" !== "string") {
$ERROR('#4: typeof "" === "string". Actual: ' + (typeof ""));
}
assert.sameValue(
typeof "",
"string",
'#4: typeof "" === "string". Actual: ' + (typeof "")
);
//CHECK#5
if (typeof "true" !== "string") {
$ERROR('#5: typeof "true" === "string". Actual: ' + (typeof "true"));
}
assert.sameValue(
typeof "true",
"string",
'#5: typeof "true" === "string". Actual: ' + (typeof "true")
);
//CHECK#6
if (typeof Date() !== "string") {
$ERROR('#6: typeof Date() === "string". Actual: ' + (typeof Date()));
}
assert.sameValue(
typeof Date(),
"string",
'#6: typeof Date() === "string". Actual: ' + (typeof Date())
);

View File

@ -10,52 +10,62 @@ es6id: 12.5.6.1
description: Checking by using eval
---*/
//CHECK#1
if (eval("var x = 0; typeof\u0009x") !== "number") {
$ERROR('#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u0009x"),
"number",
'#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x)
);
//CHECK#2
if (eval("var x = 0; typeof\u000Bx") !== "number") {
$ERROR('#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u000Bx"),
"number",
'#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x)
);
//CHECK#3
if (eval("var x = 0; typeof\u000Cx") !== "number") {
$ERROR('#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u000Cx"),
"number",
'#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x)
);
//CHECK#4
if (eval("var x = 0; typeof\u0020x") !== "number") {
$ERROR('#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u0020x"),
"number",
'#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x)
);
//CHECK#5
if (eval("var x = 0; typeof\u00A0x") !== "number") {
$ERROR('#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u00A0x"),
"number",
'#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x)
);
//CHECK#6
if (eval("var x = 0; typeof\u000Ax") !== "number") {
$ERROR('#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u000Ax"),
"number",
'#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x)
);
//CHECK#7
if (eval("var x = 0; typeof\u000Dx") !== "number") {
$ERROR('#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u000Dx"),
"number",
'#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x)
);
//CHECK#8
if (eval("var x = 0; typeof\u2028x") !== "number") {
$ERROR('#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u2028x"),
"number",
'#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x)
);
//CHECK#9
if (eval("var x = 0; typeof\u2029x") !== "number") {
$ERROR('#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u2029x"),
"number",
'#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x)
);
//CHECK#10
if (eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== "number") {
$ERROR('#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x));
}
assert.sameValue(
eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x"),
"number",
'#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x)
);

View File

@ -8,12 +8,14 @@ es6id: 12.5.6.1
description: typeof undefined === "undefined"
---*/
//CHECK#1
if (typeof undefined !== "undefined") {
$ERROR('#1: typeof undefined === "undefined". Actual: ' + (typeof undefined));
}
assert.sameValue(
typeof undefined,
"undefined",
'#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)
);
//CHECK#2
if (typeof void 0 !== "undefined") {
$ERROR('#2: typeof void 0 === "undefined". Actual: ' + (typeof void 0));
}
assert.sameValue(
typeof void 0,
"undefined",
'#2: typeof void 0 === "undefined". Actual: ' + (typeof void 0)
);

View File

@ -8,7 +8,6 @@ es6id: 12.5.6.1
description: If GetBase(x) is null, return "undefined"
---*/
//CHECK#1
if (typeof x !== "undefined") {
$ERROR('#1: typeof x === "undefined". Actual: ' + (typeof x));
}
assert.sameValue(
typeof x, "undefined", '#1: typeof x === "undefined". Actual: ' + (typeof x)
);