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" description: typeof (boolean value) === "boolean"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof true !== "boolean") { typeof true,
$ERROR('#1: typeof true === "boolean". Actual: ' + (typeof true)); "boolean",
} '#1: typeof true === "boolean". Actual: ' + (typeof true)
);
//CHECK#2 assert.sameValue(
if (typeof false !== "boolean") { typeof false,
$ERROR('#2: typeof false === "boolean". Actual: ' + (typeof false)); "boolean",
} '#2: typeof false === "boolean". Actual: ' + (typeof false)
);
//CHECK#3 assert.sameValue(
if (typeof !-1 !== "boolean") { typeof !-1,
$ERROR('#3: typeof !-1 === "boolean". Actual: ' + (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 description: Checking types of parseInt and Math.exp
---*/ ---*/
//CHECK#1 assert.sameValue(
if(typeof(Math.exp)!=="function") typeof(Math.exp),
$ERROR('#1: typeof(Math.exp)!=="function" '+typeof(Math.exp)); "function",
'#1: typeof(Math.exp)!=="function" '+typeof(Math.exp)
);
//CHECK#2 assert.sameValue(
if(typeof(parseInt)!=="function") typeof(parseInt),
$ERROR('#2: typeof(parseInt)!=="function" '+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 description: Either Type(x) is not Reference or GetBase(x) is not null
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof 0 !== "number") { typeof 0,
$ERROR('#1: typeof 0 === "number". Actual: ' + (typeof 0)); "number",
} '#1: typeof 0 === "number". Actual: ' + (typeof 0)
);
//CHECK#2
var x = 0; var x = 0;
if (typeof x !== "number") { assert.sameValue(
$ERROR('#2: typeof x === "number". Actual: ' + (typeof x)); typeof x,
} "number",
'#2: typeof x === "number". Actual: ' + (typeof x)
);
//CHECK#3
var x = new Object(); var x = new Object();
if (typeof x !== "object") { assert.sameValue(
$ERROR('#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x)); 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" description: typeof (object with [[Call]]) === "function"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof new Function() !== "function") { typeof new Function(),
$ERROR('#1: typeof new Function() === "function". Actual: ' + (typeof new Function())); "function",
} '#1: typeof new Function() === "function". Actual: ' + (typeof new Function())
);
//CHECK#2 assert.sameValue(
if (typeof Function() !== "function") { typeof Function(),
$ERROR('#2: typeof Function() === "function". Actual: ' + (typeof Function())); "function",
} '#2: typeof Function() === "function". Actual: ' + (typeof Function())
);
//CHECK#3 assert.sameValue(
if (typeof Object !== "function") { typeof Object,
$ERROR('#3: typeof Object === "function". Actual: ' + (typeof Object)); "function",
} '#3: typeof Object === "function". Actual: ' + (typeof Object)
);
//CHECK#4 assert.sameValue(
if (typeof String !== "function") { typeof String,
$ERROR('#4: typeof String === "function". Actual: ' + (typeof String)); "function",
} '#4: typeof String === "function". Actual: ' + (typeof String)
);
//CHECK5 assert.sameValue(
if (typeof Boolean !== "function") { typeof Boolean,
$ERROR('#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)); "function",
} '#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)
);
//CHECK#6 assert.sameValue(
if (typeof Number !== "function") { typeof Number,
$ERROR('#6: typeof Number === "function". Actual: ' + (typeof Number)); "function",
} '#6: typeof Number === "function". Actual: ' + (typeof Number)
);
//CHECK#7 assert.sameValue(
if (typeof Date !== "function") { typeof Date,
$ERROR('#7: typeof Date === "function". Actual: ' + (typeof Date)); "function",
} '#7: typeof Date === "function". Actual: ' + (typeof Date)
);
//CHECK#8 assert.sameValue(
if (typeof Error !== "function") { typeof Error,
$ERROR('#8: typeof Error === "function". Actual: ' + (typeof Error)); "function",
} '#8: typeof Error === "function". Actual: ' + (typeof Error)
);
//CHECK#9 assert.sameValue(
if (typeof RegExp !== "function") { typeof RegExp,
$ERROR('#9: typeof RegExp === "function". Actual: ' + (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" description: typeof (object without [[Call]]) === "object"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof this !== "object") { typeof this,
$ERROR('#1: typeof this === "object". Actual: ' + (typeof this)); "object",
} '#1: typeof this === "object". Actual: ' + (typeof this)
);
//CHECK#2 assert.sameValue(
if (typeof new Object() !== "object") { typeof new Object(),
$ERROR('#2: typeof new Object() === "object". Actual: ' + (typeof new Object())); "object",
} '#2: typeof new Object() === "object". Actual: ' + (typeof new Object())
);
//CHECK#3 assert.sameValue(
if (typeof new Array(1,2,3) !== "object") { typeof new Array(1,2,3),
$ERROR('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))); "object",
} '#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))
);
//CHECK#4 assert.sameValue(
if (typeof Array(1,2,3) !== "object") { typeof Array(1,2,3),
$ERROR('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))); "object",
} '#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))
);
//CHECK#5 assert.sameValue(
if (typeof new String("x") !== "object") { typeof new String("x"),
$ERROR('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))); "object",
} '#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))
);
//CHECK#6 assert.sameValue(
if (typeof new Boolean(true) !== "object") { typeof new Boolean(true),
$ERROR('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))); "object",
} '#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))
);
//CHECK#7 assert.sameValue(
if (typeof new Number(1) !== "object") { typeof new Number(1),
$ERROR('#7: typeof new Number(1) === "object". Actual: ' + (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; //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. //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. //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") { assert.sameValue(
$ERROR('#8: typeof Math === "object". Actual: ' + (typeof Math)); typeof Math,
} "object",
'#8: typeof Math === "object". Actual: ' + (typeof Math)
);
//CHECK#9 assert.sameValue(
if (typeof new Date() !== "object") { typeof new Date(),
$ERROR('#9: typeof new Date() === "object". Actual: ' + (typeof new Date())); "object",
} '#9: typeof new Date() === "object". Actual: ' + (typeof new Date())
);
//CHECK#10 assert.sameValue(
if (typeof new Error() !== "object") { typeof new Error(),
$ERROR('#10: typeof new Error() === "object". Actual: ' + (typeof new Error())); "object",
} '#10: typeof new Error() === "object". Actual: ' + (typeof new Error())
);
//CHECK#11 assert.sameValue(
if (typeof new RegExp() !== "object") { typeof new RegExp(),
$ERROR('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())); "object",
} '#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())
);
//CHECK#12 assert.sameValue(
if (typeof RegExp() !== "object") { typeof RegExp(),
$ERROR('#12: typeof RegExp() === "object". Actual: ' + (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" description: typeof null === "object"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof null !== "object") { typeof null,
$ERROR('#1: typeof null === "object". Actual: ' + (typeof null)); "object",
} '#1: typeof null === "object". Actual: ' + (typeof null)
);
//CHECK#2 assert.sameValue(
if (typeof RegExp("0").exec("1") !== "object") { typeof RegExp("0").exec("1"),
$ERROR('#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (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" description: typeof (number value) === "number"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof 1 !== "number") { typeof 1,
$ERROR('#1: typeof 1 === "number". Actual: ' + (typeof 1)); "number",
} '#1: typeof 1 === "number". Actual: ' + (typeof 1)
);
//CHECK#2 assert.sameValue(
if (typeof Number.NaN !== "number") { typeof Number.NaN,
$ERROR('#2: typeof NaN === "number". Actual: ' + (typeof NaN)); "number",
} '#2: typeof NaN === "number". Actual: ' + (typeof NaN)
);
//CHECK#3 assert.sameValue(
if (typeof Number.POSITIVE_INFINITY !== "number") { typeof Number.POSITIVE_INFINITY,
$ERROR('#3: typeof Infinity === "number". Actual: ' + (typeof Infinity)); "number",
} '#3: typeof Infinity === "number". Actual: ' + (typeof Infinity)
);
//CHECK#4 assert.sameValue(
if (typeof Number.NEGATIVE_INFINITY !== "number") { typeof Number.NEGATIVE_INFINITY,
$ERROR('#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity)); "number",
} '#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity)
);
//CHECK#5 assert.sameValue(
if (typeof Math.PI !== "number") { typeof Math.PI,
$ERROR('#5: typeof Math.PI === "number". Actual: ' + (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" description: typeof (string value) === "string"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof "1" !== "string") { typeof "1",
$ERROR('#1: typeof "1" === "string". Actual: ' + (typeof "1")); "string",
} '#1: typeof "1" === "string". Actual: ' + (typeof "1")
);
//CHECK#2 assert.sameValue(
if (typeof "NaN" !== "string") { typeof "NaN",
$ERROR('#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")); "string",
} '#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")
);
//CHECK#3 assert.sameValue(
if (typeof "Infinity" !== "string") { typeof "Infinity",
$ERROR('#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")); "string",
} '#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")
);
//CHECK#4 assert.sameValue(
if (typeof "" !== "string") { typeof "",
$ERROR('#4: typeof "" === "string". Actual: ' + (typeof "")); "string",
} '#4: typeof "" === "string". Actual: ' + (typeof "")
);
//CHECK#5 assert.sameValue(
if (typeof "true" !== "string") { typeof "true",
$ERROR('#5: typeof "true" === "string". Actual: ' + (typeof "true")); "string",
} '#5: typeof "true" === "string". Actual: ' + (typeof "true")
);
//CHECK#6 assert.sameValue(
if (typeof Date() !== "string") { typeof Date(),
$ERROR('#6: typeof Date() === "string". Actual: ' + (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 description: Checking by using eval
---*/ ---*/
//CHECK#1 assert.sameValue(
if (eval("var x = 0; typeof\u0009x") !== "number") { eval("var x = 0; typeof\u0009x"),
$ERROR('#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x)); "number",
} '#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x)
);
//CHECK#2 assert.sameValue(
if (eval("var x = 0; typeof\u000Bx") !== "number") { eval("var x = 0; typeof\u000Bx"),
$ERROR('#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x)); "number",
} '#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x)
);
//CHECK#3 assert.sameValue(
if (eval("var x = 0; typeof\u000Cx") !== "number") { eval("var x = 0; typeof\u000Cx"),
$ERROR('#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x)); "number",
} '#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x)
);
//CHECK#4 assert.sameValue(
if (eval("var x = 0; typeof\u0020x") !== "number") { eval("var x = 0; typeof\u0020x"),
$ERROR('#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x)); "number",
} '#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x)
);
//CHECK#5 assert.sameValue(
if (eval("var x = 0; typeof\u00A0x") !== "number") { eval("var x = 0; typeof\u00A0x"),
$ERROR('#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x)); "number",
} '#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x)
);
//CHECK#6 assert.sameValue(
if (eval("var x = 0; typeof\u000Ax") !== "number") { eval("var x = 0; typeof\u000Ax"),
$ERROR('#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x)); "number",
} '#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x)
);
//CHECK#7 assert.sameValue(
if (eval("var x = 0; typeof\u000Dx") !== "number") { eval("var x = 0; typeof\u000Dx"),
$ERROR('#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x)); "number",
} '#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x)
);
//CHECK#8 assert.sameValue(
if (eval("var x = 0; typeof\u2028x") !== "number") { eval("var x = 0; typeof\u2028x"),
$ERROR('#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x)); "number",
} '#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x)
);
//CHECK#9 assert.sameValue(
if (eval("var x = 0; typeof\u2029x") !== "number") { eval("var x = 0; typeof\u2029x"),
$ERROR('#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x)); "number",
} '#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x)
);
//CHECK#10 assert.sameValue(
if (eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== "number") { eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x"),
$ERROR('#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x)); "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" description: typeof undefined === "undefined"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof undefined !== "undefined") { typeof undefined,
$ERROR('#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)); "undefined",
} '#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)
);
//CHECK#2 assert.sameValue(
if (typeof void 0 !== "undefined") { typeof void 0,
$ERROR('#2: typeof void 0 === "undefined". Actual: ' + (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" description: If GetBase(x) is null, return "undefined"
---*/ ---*/
//CHECK#1 assert.sameValue(
if (typeof x !== "undefined") { typeof x, "undefined", '#1: typeof x === "undefined". Actual: ' + (typeof x)
$ERROR('#1: typeof x === "undefined". Actual: ' + (typeof x)); );
}