Merge pull request #3142 from tc39/rwaldron/transform-legacy-002

Transform legacy format to harness assertions: test/built-ins/B*/**/*.js
This commit is contained in:
Leo Balter 2021-08-19 10:36:06 -07:00 committed by GitHub
commit 82db0c4a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 336 additions and 833 deletions

View File

@ -10,23 +10,17 @@ description: >
Used values 1, new String("1"), new Object(1) and called without
argument
---*/
assert.sameValue(typeof Boolean(), "boolean", 'The value of `typeof Boolean()` is expected to be "boolean"');
assert.sameValue(typeof Boolean(1), "boolean", 'The value of `typeof Boolean(1)` is expected to be "boolean"');
//CHECK#1
if (typeof Boolean() !== "boolean") {
throw new Test262Error('#1: typeof Boolean() should be "boolean", actual is "' + typeof Boolean() + '"');
}
assert.sameValue(
typeof Boolean(new String("1")),
"boolean",
'The value of `typeof Boolean(new String("1"))` is expected to be "boolean"'
);
//CHECK#2
if (typeof Boolean(1) !== "boolean") {
throw new Test262Error('#2: typeof Boolean(1) should be "boolean", actual is "' + typeof Boolean(1) + '"');
}
//CHECK#3
if (typeof Boolean(new String("1")) !== "boolean") {
throw new Test262Error('#3: typeof Boolean(new String("1")) should be "boolean", actual is "' + typeof Boolean(new String("1")) + '"');
}
//CHECK#4
if (typeof Boolean(new Object(1)) !== "boolean") {
throw new Test262Error('#4: typeof Boolean(new Object(1)) should be "boolean", actual is "' + typeof Boolean(new Object(1)) + '"');
}
assert.sameValue(
typeof Boolean(new Object(1)),
"boolean",
'The value of `typeof Boolean(new Object(1))` is expected to be "boolean"'
);

View File

@ -8,35 +8,17 @@ info: |
esid: sec-terms-and-definitions-boolean-value
description: Used various number values as argument
---*/
assert.sameValue(typeof Boolean(0), "boolean", 'The value of `typeof Boolean(0)` is expected to be "boolean"');
assert.sameValue(Boolean(0), false, 'Boolean(0) must return false');
assert.sameValue(typeof Boolean(-1), "boolean", 'The value of `typeof Boolean(-1)` is expected to be "boolean"');
assert.sameValue(Boolean(-1), true, 'Boolean(-1) must return true');
//CHECK#1
if (typeof Boolean(0) !== "boolean") {
throw new Test262Error('#1.1: typeof Boolean(0) should be "boolean", actual is "' + typeof Boolean(0) + '"');
}
if (Boolean(0) !== false) {
throw new Test262Error('#1.2: Boolean(0) should be false, actual is ' + Boolean(0));
}
assert.sameValue(
typeof Boolean(-Infinity),
"boolean",
'The value of `typeof Boolean(-Infinity)` is expected to be "boolean"'
);
//CHECK#2
if (typeof Boolean(-1) !== "boolean") {
throw new Test262Error('#2.1: typeof Boolean(-1) should be "boolean", actual is "' + typeof Boolean(-1) + '"');
}
if (Boolean(-1) !== true) {
throw new Test262Error('#2.2: Boolean(-1) should be true, actual is ' + Boolean(-1));
}
//CHECK#3
if (typeof Boolean(-Infinity) !== "boolean") {
throw new Test262Error('#3.1: typeof Boolean(-Infinity) should be "boolean", actual is "' + typeof Boolean(-Infinity) + '"');
}
if (Boolean(-Infinity) !== true) {
throw new Test262Error('#3.2: Boolean(-Infinity) should be true, actual is ' + Boolean(-Infinity));
}
//CHECK#4
if (typeof Boolean(NaN) !== "boolean") {
throw new Test262Error('#4.1: typeof Boolean(NaN) should be "boolean", actual is "' + typeof Boolean(NaN) + '"');
}
if (Boolean(NaN) !== false) {
throw new Test262Error('#4.2: Boolean(NaN) should be false, actual is ' + Boolean(NaN));
}
assert.sameValue(Boolean(-Infinity), true, 'Boolean(-Infinity) must return true');
assert.sameValue(typeof Boolean(NaN), "boolean", 'The value of `typeof Boolean(NaN)` is expected to be "boolean"');
assert.sameValue(Boolean(NaN), false, 'Boolean(NaN) must return false');

View File

@ -1,6 +1,5 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
Returns a boolean value (not a Boolean object) computed by
@ -9,42 +8,25 @@ esid: sec-terms-and-definitions-boolean-value
description: Used various string values as argument
---*/
//CHECK#1
if (typeof Boolean("0") !== "boolean") {
throw new Test262Error('#1.1: typeof Boolean("0") should be "boolean", actual is "' + typeof Boolean("0") + '"');
}
if (Boolean("0") !== true) {
throw new Test262Error('#1.2: Boolean("0") should be true');
}
assert.sameValue(typeof Boolean("0"), "boolean", 'The value of `typeof Boolean("0")` is expected to be "boolean"');
assert.sameValue(Boolean("0"), true, 'Boolean("0") must return true');
assert.sameValue(typeof Boolean("-1"), "boolean", 'The value of `typeof Boolean("-1")` is expected to be "boolean"');
assert.sameValue(Boolean("-1"), true, 'Boolean("-1") must return true');
assert.sameValue(typeof Boolean("1"), "boolean", 'The value of `typeof Boolean("1")` is expected to be "boolean"');
assert.sameValue(Boolean("1"), true, 'Boolean("1") must return true');
//CHECK#2
if (typeof Boolean("-1") !== "boolean") {
throw new Test262Error('#2.1: typeof Boolean("-1") should be "boolean", actual is "' + typeof Boolean("-1") + '"');
}
if (Boolean("-1") !== true) {
throw new Test262Error('#2.2: Boolean("-1") should be true');
}
assert.sameValue(
typeof Boolean("false"),
"boolean",
'The value of `typeof Boolean("false")` is expected to be "boolean"'
);
//CHECK#3
if (typeof Boolean("1") !== "boolean") {
throw new Test262Error('#3.1: typeof Boolean("1") should be "boolean", actual is "' + typeof Boolean("1") + '"');
}
if (Boolean("1") !== true) {
throw new Test262Error('#3.2: Boolean("1") should be true');
}
assert.sameValue(Boolean("false"), true, 'Boolean("false") must return true');
//CHECK#4
if (typeof Boolean("false") !== "boolean") {
throw new Test262Error('#4.1: typeof Boolean("false") should be "boolean", actual is "' + typeof Boolean("false") + '"');
}
if (Boolean("false") !== true) {
throw new Test262Error('#4.2: Boolean("false") should be true');
}
assert.sameValue(
typeof Boolean("true"),
"boolean",
'The value of `typeof Boolean("true")` is expected to be "boolean"'
);
//CHECK#5
if (typeof Boolean("true") !== "boolean") {
throw new Test262Error('#5.1: typeof Boolean("true") should be "boolean", actual is "' + typeof Boolean("true") + '"');
}
if (Boolean("true") !== true) {
throw new Test262Error('#5.2: Boolean("true") should be true');
}
assert.sameValue(Boolean("true"), true, 'Boolean("true") must return true');

View File

@ -9,43 +9,31 @@ esid: sec-terms-and-definitions-boolean-value
description: Used various undefined values and null as argument
---*/
//CHECK#1
if (typeof Boolean(undefined) !== "boolean") {
throw new Test262Error('#1.1: typeof Boolean(undefined) should be "boolean", actual is "' + typeof Boolean(undefined) + '"');
}
if (Boolean(undefined) !== false) {
throw new Test262Error('#1.2: Boolean(undefined) should be false');
}
assert.sameValue(
typeof Boolean(undefined),
"boolean",
'The value of `typeof Boolean(undefined)` is expected to be "boolean"'
);
//CHECK#2
if (typeof Boolean(void 0) !== "boolean") {
throw new Test262Error('#2.1: typeof Boolean(void 0) should be "boolean", actual is "' + typeof Boolean(void 0) + '"');
}
if (Boolean(void 0) !== false) {
throw new Test262Error('#2.2: Boolean(void 0) should be false');
}
assert.sameValue(Boolean(undefined), false, 'Boolean(undefined) must return false');
//CHECK#3
if (typeof Boolean(function() {}()) !== "boolean") {
throw new Test262Error('#3.1: typeof Boolean(function(){}()) should be "boolean", actual is "' + typeof Boolean(function() {}()) + '"');
}
if (Boolean(function() {}()) !== false) {
throw new Test262Error('#3.2: Boolean(function(){}()) should be false');
}
assert.sameValue(
typeof Boolean(void 0),
"boolean",
'The value of `typeof Boolean(void 0)` is expected to be "boolean"'
);
//CHECK#4
if (typeof Boolean(null) !== "boolean") {
throw new Test262Error('#4.1: typeof Boolean(null) should be "boolean", actual is "' + typeof Boolean(null) + '"');
}
if (Boolean(null) !== false) {
throw new Test262Error('#4.2: Boolean(null) should be false');
}
assert.sameValue(Boolean(void 0), false, 'Boolean(void 0) must return false');
//CHECK#5
if (typeof Boolean(x) !== "boolean") {
throw new Test262Error('#5.1: var x; typeof Boolean(x) should be "boolean", actual is "' + typeof Boolean(x) + '"');
}
if (Boolean(x) !== false) {
throw new Test262Error('#5.2: var x; Boolean(x) should be false');
}
assert.sameValue(
typeof Boolean(function() {}()),
"boolean",
'The value of `typeof Boolean(function() {}())` is expected to be "boolean"'
);
assert.sameValue(Boolean(function() {}()), false, 'Boolean(function() {}()) must return false');
assert.sameValue(typeof Boolean(null), "boolean", 'The value of `typeof Boolean(null)` is expected to be "boolean"');
assert.sameValue(Boolean(null), false, 'Boolean(null) must return false');
assert.sameValue(typeof Boolean(x), "boolean", 'The value of `typeof Boolean(x)` is expected to be "boolean"');
assert.sameValue(Boolean(x), false, 'Boolean() must return false');
var x;

View File

@ -11,42 +11,31 @@ description: Used various assigning values to any variable as argument
var x;
//CHECK#1
if (typeof Boolean(x = 0) !== "boolean") {
throw new Test262Error('#1.1: typeof Boolean(x=0) should be "boolean", actual is "' + typeof Boolean(x = 0) + '"');
}
if (Boolean(x = 0) !== false) {
throw new Test262Error('#1.2: Boolean(x=0) should be false');
}
assert.sameValue(typeof Boolean(x = 0), "boolean", 'The value of `typeof Boolean(x = 0)` is expected to be "boolean"');
assert.sameValue(Boolean(x = 0), false, 'Boolean(x = 0) must return false');
assert.sameValue(typeof Boolean(x = 1), "boolean", 'The value of `typeof Boolean(x = 1)` is expected to be "boolean"');
assert.sameValue(Boolean(x = 1), true, 'Boolean(x = 1) must return true');
//CHECK#2
if (typeof Boolean(x = 1) !== "boolean") {
throw new Test262Error('#2.1: typeof Boolean(x=1) should be "boolean", actual is "' + typeof Boolean(x = 1) + '"');
}
if (Boolean(x = 1) !== true) {
throw new Test262Error('#2.2: Boolean(x=1) should be true');
}
assert.sameValue(
typeof Boolean(x = false),
"boolean",
'The value of `typeof Boolean(x = false)` is expected to be "boolean"'
);
//CHECK#3
if (typeof Boolean(x = false) !== "boolean") {
throw new Test262Error('#3.1: typeof Boolean(x=false) should be "boolean", actual is "' + typeof Boolean(x = false) + '"');
}
if (Boolean(x = false) !== false) {
throw new Test262Error('#3.2: Boolean(x=false) should be false');
}
assert.sameValue(Boolean(x = false), false, 'Boolean(x = false) must return false');
//CHECK#4
if (typeof Boolean(x = true) !== "boolean") {
throw new Test262Error('#4.1: typeof Boolean(x=true) should be "boolean", actual is "' + typeof Boolean(x = true) + '"');
}
if (Boolean(x = true) !== true) {
throw new Test262Error('#4.2: Boolean(x=true) should be true');
}
assert.sameValue(
typeof Boolean(x = true),
"boolean",
'The value of `typeof Boolean(x = true)` is expected to be "boolean"'
);
//CHECK#5
if (typeof Boolean(x = null) !== "boolean") {
throw new Test262Error('#5.1: typeof Boolean(x=null) should be "boolean", actual is "' + typeof Boolean(x = null) + '"');
}
if (Boolean(x = null) !== false) {
throw new Test262Error('#5.2: Boolean(x=null) should be false');
}
assert.sameValue(Boolean(x = true), true, 'Boolean(x = true) must return true');
assert.sameValue(
typeof Boolean(x = null),
"boolean",
'The value of `typeof Boolean(x = null)` is expected to be "boolean"'
);
assert.sameValue(Boolean(x = null), false, 'Boolean(x = null) must return false');

View File

@ -6,13 +6,5 @@ info: Boolean() returns false
esid: sec-terms-and-definitions-boolean-value
description: Call Boolean() and check result
---*/
//CHECK#1
if (typeof Boolean() !== "boolean") {
throw new Test262Error('#1: typeof Boolean() should be "boolean", actual is "' + typeof Boolean() + '"');
}
//CHECK#2
if (Boolean() !== false) {
throw new Test262Error('#2: Boolean() should be false');
}
assert.sameValue(typeof Boolean(), "boolean", 'The value of `typeof Boolean()` is expected to be "boolean"');
assert.sameValue(Boolean(), false, 'Boolean() must return false');

View File

@ -9,46 +9,19 @@ esid: sec-boolean-constructor
description: Checking type of the newly created object and it value
---*/
//CHECK#1
if (typeof new Boolean() !== "object") {
throw new Test262Error("#1: typeof new Boolean() === 'object'");
}
assert.sameValue(typeof new Boolean(), "object", 'The value of `typeof new Boolean()` is expected to be "object"');
assert.notSameValue(new Boolean(), undefined, 'new Boolean() is expected to not equal ``undefined``');
//CHECK#2
if (new Boolean() === undefined) {
throw new Test262Error("#2: new Boolean() should not be undefined");
}
//CHECK#3
var x3 = new Boolean();
if (typeof x3 !== "object") {
throw new Test262Error("#3: typeof new Boolean() !== 'object'");
}
assert.sameValue(typeof x3, "object", 'The value of `typeof x3` is expected to be "object"');
//CHECK#4
var x4 = new Boolean();
if (x4 === undefined) {
throw new Test262Error("#4: new Boolean() should not be undefined");
}
assert.notSameValue(x4, undefined, 'The value of x4 is expected to not equal ``undefined``');
assert.sameValue(typeof new Boolean(1), "object", 'The value of `typeof new Boolean(1)` is expected to be "object"');
assert.notSameValue(new Boolean(1), undefined, 'new Boolean(1) is expected to not equal ``undefined``');
//CHECK#5
if (typeof new Boolean(1) !== "object") {
throw new Test262Error("#5: typeof new Boolean(10) === 'object'");
}
//CHECK#6
if (new Boolean(1) === undefined) {
throw new Test262Error("#6: new Boolean(1) should not be undefined");
}
//CHECK#7
var x7 = new Boolean(1);
if (typeof x7 !== "object") {
throw new Test262Error("#7: typeof new Boolean(1) !== 'object'");
}
assert.sameValue(typeof x7, "object", 'The value of `typeof x7` is expected to be "object"');
//CHECK#8
var x8 = new Boolean(1);
if (x8 === undefined) {
throw new Test262Error("#8: new Boolean(1) should not be undefined");
}
assert.notSameValue(x8, undefined, 'The value of x8 is expected to not equal ``undefined``');

View File

@ -12,18 +12,20 @@ description: Checking prototype property of the newly created object
// CHECK#1
var x1 = new Boolean(1);
if (typeof x1.constructor.prototype !== "object") {
throw new Test262Error('#1: typeof x1.constructor.prototype === "object"');
}
//CHECK#2
assert.sameValue(
typeof x1.constructor.prototype,
"object",
'The value of `typeof x1.constructor.prototype` is expected to be "object"'
);
var x2 = new Boolean(2);
if (!Boolean.prototype.isPrototypeOf(x2)) {
throw new Test262Error('#2: Boolean.prototype.isPrototypeOf(x2)');
}
assert(Boolean.prototype.isPrototypeOf(x2), 'Boolean.prototype.isPrototypeOf(x2) must return true');
//CHECK#3
var x3 = new Boolean(3);
if (Boolean.prototype !== x3.constructor.prototype) {
throw new Test262Error('#3: Boolean.prototype === x3.constructor.prototype');
}
assert.sameValue(
Boolean.prototype,
x3.constructor.prototype,
'The value of Boolean.prototype is expected to equal the value of x3.constructor.prototype'
);

View File

@ -11,24 +11,13 @@ description: Checking value of the newly created object
// CHECK#1
var x1 = new Boolean(1);
if (x1.valueOf() !== true) {
throw new Test262Error('#1: var x1 = new Boolean(1); x1.valueOf() === true');
}
assert.sameValue(x1.valueOf(), true, 'x1.valueOf() must return true');
//CHECK#2
var x2 = new Boolean();
if (x2.valueOf() !== false) {
throw new Test262Error('#2: var x2 = new Boolean(); x2.valueOf() === false');
}
assert.sameValue(x2.valueOf(), false, 'x2.valueOf() must return false');
//CHECK#3
var x2 = new Boolean(0);
if (x2.valueOf() !== false) {
throw new Test262Error('#3: var x2 = new Boolean(0); x2.valueOf() === false');
}
assert.sameValue(x2.valueOf(), false, 'x2.valueOf() must return false');
//CHECK#4
var x2 = new Boolean(new Object());
if (x2.valueOf() !== true) {
throw new Test262Error('#4: var x2 = new Boolean(new Object()); x2.valueOf() === true');
}
assert.sameValue(x2.valueOf(), true, 'x2.valueOf() must return true');

View File

@ -13,7 +13,4 @@ delete Boolean.prototype.toString;
var obj = new Boolean();
//CHECK#1
if (obj.toString() !== "[object Boolean]") {
throw new Test262Error('#1: The [[Class]] property of the newly constructed object is set to "Boolean"');
}
assert.sameValue(obj.toString(), "[object Boolean]", 'obj.toString() must return "[object Boolean]"');

View File

@ -6,7 +6,4 @@ info: The Boolean constructor has the property "prototype"
esid: sec-boolean.prototype
description: Checking existence of the property "prototype"
---*/
if (!Boolean.hasOwnProperty("prototype")) {
throw new Test262Error('#1: The Boolean constructor has the property "prototype"');
}
assert(Boolean.hasOwnProperty("prototype"), 'Boolean.hasOwnProperty("prototype") must return true');

View File

@ -8,8 +8,7 @@ info: |
esid: sec-boolean.prototype
description: Checking prototype of the Boolean constructor
---*/
//CHECK#1
if (!(Function.prototype.isPrototypeOf(Boolean))) {
throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Boolean constructor is the Function prototype object.');
}
assert(
Function.prototype.isPrototypeOf(Boolean),
'Function.prototype.isPrototypeOf(Boolean) must return true'
);

View File

@ -6,13 +6,5 @@ info: Boolean constructor has length property whose value is 1
esid: sec-boolean.prototype
description: Checking Boolean.length property
---*/
//CHECK#1
if (!Boolean.hasOwnProperty("length")) {
throw new Test262Error('#1: Boolean constructor has length property');
}
//CHECK#2
if (Boolean.length !== 1) {
throw new Test262Error('#2: Boolean constructor length property value is 1');
}
assert(Boolean.hasOwnProperty("length"), 'Boolean.hasOwnProperty("length") must return true');
assert.sameValue(Boolean.length, 1, 'The value of Boolean.length is expected to be 1');

View File

@ -9,22 +9,7 @@ description: >
transformation
---*/
// CHECK#1
if (Boolean(undefined) !== false) {
throw new Test262Error('#1: Boolean(undefined) === false. Actual: ' + (Boolean(undefined)));
}
// CHECK#2
if (Boolean(void 0) !== false) {
throw new Test262Error('#2: Boolean(undefined) === false. Actual: ' + (Boolean(undefined)));
}
// CHECK#3
if (Boolean(eval("var x")) !== false) {
throw new Test262Error('#3: Boolean(eval("var x")) === false. Actual: ' + (Boolean(eval("var x"))));
}
// CHECK#4
if (Boolean() !== false) {
throw new Test262Error('#4: Boolean() === false. Actual: ' + (Boolean()));
}
assert.sameValue(Boolean(undefined), false, 'Boolean(undefined) must return false');
assert.sameValue(Boolean(void 0), false, 'Boolean(void 0) must return false');
assert.sameValue(Boolean(eval("var x")), false, 'Boolean(eval("var x")) must return false');
assert.sameValue(Boolean(), false, 'Boolean() must return false');

View File

@ -6,8 +6,4 @@ info: Result of boolean conversion from null value is false
esid: sec-toboolean
description: null convert to Boolean by explicit transformation
---*/
// CHECK#1
if (Boolean(null) !== false) {
throw new Test262Error('#1: Boolean(null) === false. Actual: ' + (Boolean(null)));
}
assert.sameValue(Boolean(null), false, 'Boolean(null) must return false');

View File

@ -6,13 +6,5 @@ info: Result of boolean conversion from boolean value is no conversion
esid: sec-toboolean
description: true and false convert to Boolean by explicit transformation
---*/
// CHECK#1
if (Boolean(true) !== true) {
throw new Test262Error('#1: Boolean(true) === true. Actual: ' + (Boolean(true)));
}
// CHECK#2
if (Boolean(false) !== false) {
throw new Test262Error('#2: Boolean(false) === false. Actual: ' + (Boolean(false)));
}
assert.sameValue(Boolean(true), true, 'Boolean(true) must return true');
assert.sameValue(Boolean(false), false, 'Boolean(false) must return false');

View File

@ -8,18 +8,6 @@ info: |
esid: sec-toboolean
description: +0, -0 and NaN convert to Boolean by explicit transformation
---*/
// CHECK#1
if (Boolean(+0) !== false) {
throw new Test262Error('#1: Boolean(+0) === false. Actual: ' + (Boolean(+0)));
}
// CHECK#2
if (Boolean(-0) !== false) {
throw new Test262Error('#2: Boolean(-0) === false. Actual: ' + (Boolean(-0)));
}
// CHECK#3
if (Boolean(Number.NaN) !== false) {
throw new Test262Error('#3: Boolean(Number.NaN) === false. Actual: ' + (Boolean(Number.NaN)));
}
assert.sameValue(Boolean(+0), false, 'Boolean(+0) must return false');
assert.sameValue(Boolean(-0), false, 'Boolean(-0) must return false');
assert.sameValue(Boolean(Number.NaN), false, 'Boolean(Number.NaN) must return false');

View File

@ -11,43 +11,11 @@ description: >
Number.MAX_VALUE, Number.MIN_VALUE and some numbers convert to
Boolean by explicit transformation
---*/
// CHECK#1
if (Boolean(Number.POSITIVE_INFINITY) !== true) {
throw new Test262Error('#1: Boolean(+Infinity) === true. Actual: ' + (Boolean(+Infinity)));
}
// CHECK#2;
if (Boolean(Number.NEGATIVE_INFINITY) !== true) {
throw new Test262Error('#2: Boolean(-Infinity) === true. Actual: ' + (Boolean(-Infinity)));
}
// CHECK#3
if (Boolean(Number.MAX_VALUE) !== true) {
throw new Test262Error('#3: Boolean(Number.MAX_VALUE) === true. Actual: ' + (Boolean(Number.MAX_VALUE)));
}
// CHECK#4
if (Boolean(Number.MIN_VALUE) !== true) {
throw new Test262Error('#4: Boolean(Number.MIN_VALUE) === true. Actual: ' + (Boolean(Number.MIN_VALUE)));
}
// CHECK#5
if (Boolean(13) !== true) {
throw new Test262Error('#5: Boolean(13) === true. Actual: ' + (Boolean(13)));
}
// CHECK#6
if (Boolean(-13) !== true) {
throw new Test262Error('#6: Boolean(-13) === true. Actual: ' + (Boolean(-13)));
}
// CHECK#7
if (Boolean(1.3) !== true) {
throw new Test262Error('#7: Boolean(1.3) === true. Actual: ' + (Boolean(1.3)));
}
// CHECK#8
if (Boolean(-1.3) !== true) {
throw new Test262Error('#8: Boolean(-1.3) === true. Actual: ' + (Boolean(-1.3)));
}
assert.sameValue(Boolean(Number.POSITIVE_INFINITY), true, 'Boolean(Number.POSITIVE_INFINITY) must return true');
assert.sameValue(Boolean(Number.NEGATIVE_INFINITY), true, 'Boolean(Number.NEGATIVE_INFINITY) must return true');
assert.sameValue(Boolean(Number.MAX_VALUE), true, 'Boolean(Number.MAX_VALUE) must return true');
assert.sameValue(Boolean(Number.MIN_VALUE), true, 'Boolean(Number.MIN_VALUE) must return true');
assert.sameValue(Boolean(13), true, 'Boolean(13) must return true');
assert.sameValue(Boolean(-13), true, 'Boolean(-13) must return true');
assert.sameValue(Boolean(1.3), true, 'Boolean(1.3) must return true');
assert.sameValue(Boolean(-1.3), true, 'Boolean(-1.3) must return true');

View File

@ -8,8 +8,4 @@ info: |
esid: sec-toboolean
description: "\"\" is converted to Boolean by explicit transformation"
---*/
// CHECK#1
if (Boolean("") !== false) {
throw new Test262Error('#1: Boolean("") === false. Actual: ' + (Boolean("")));
}
assert.sameValue(Boolean(""), false, 'Boolean("") must return false');

View File

@ -8,13 +8,5 @@ info: |
esid: sec-toboolean
description: Any nonempty string convert to Boolean by explicit transformation
---*/
// CHECK#1
if (Boolean(" ") !== true) {
throw new Test262Error('#1: Boolean(" ") === true. Actual: ' + (Boolean(" ")));
}
// CHECK#2
if (Boolean("Nonempty String") !== true) {
throw new Test262Error('#2: Boolean("Nonempty String") === true. Actual: ' + (Boolean("Nonempty String")));
}
assert.sameValue(Boolean(" "), true, 'Boolean(" ") must return true');
assert.sameValue(Boolean("Nonempty String"), true, 'Boolean("Nonempty String") must return true');

View File

@ -7,97 +7,33 @@ esid: sec-toboolean
description: Different objects convert to Boolean by explicit transformation
---*/
// CHECK#1
if (Boolean(new Object()) !== true) {
throw new Test262Error('#1: Boolean(new Object()) === true. Actual: ' + (Boolean(new Object())));
}
assert.sameValue(Boolean(new Object()), true, 'Boolean(new Object()) must return true');
assert.sameValue(Boolean(new String("")), true, 'Boolean(new String("")) must return true');
assert.sameValue(Boolean(new String()), true, 'Boolean(new String()) must return true');
assert.sameValue(Boolean(new Boolean(true)), true, 'Boolean(new Boolean(true)) must return true');
assert.sameValue(Boolean(new Boolean(false)), true, 'Boolean(new Boolean(false)) must return true');
assert.sameValue(Boolean(new Boolean()), true, 'Boolean(new Boolean()) must return true');
assert.sameValue(Boolean(new Array()), true, 'Boolean(new Array()) must return true');
assert.sameValue(Boolean(new Number()), true, 'Boolean(new Number()) must return true');
assert.sameValue(Boolean(new Number(-0)), true, 'Boolean(new Number(-0)) must return true');
assert.sameValue(Boolean(new Number(0)), true, 'Boolean(new Number(0)) must return true');
assert.sameValue(Boolean(new Number()), true, 'Boolean(new Number()) must return true');
assert.sameValue(Boolean(new Number(Number.NaN)), true, 'Boolean(new Number(Number.NaN)) must return true');
assert.sameValue(Boolean(new Number(-1)), true, 'Boolean(new Number(-1)) must return true');
assert.sameValue(Boolean(new Number(1)), true, 'Boolean(new Number(1)) must return true');
// CHECK#2
if (Boolean(new String("")) !== true) {
throw new Test262Error('#2: Boolean(new String("")) === true. Actual: ' + (Boolean(new String(""))));
}
assert.sameValue(
Boolean(new Number(Number.POSITIVE_INFINITY)),
true,
'Boolean(new Number(Number.POSITIVE_INFINITY)) must return true'
);
// CHECK#3
if (Boolean(new String()) !== true) {
throw new Test262Error('#3: Boolean(new String()) === true. Actual: ' + (Boolean(new String())));
}
assert.sameValue(
Boolean(new Number(Number.NEGATIVE_INFINITY)),
true,
'Boolean(new Number(Number.NEGATIVE_INFINITY)) must return true'
);
// CHECK#4
if (Boolean(new Boolean(true)) !== true) {
throw new Test262Error('#4: Boolean(new Boolean(true)) === true. Actual: ' + (Boolean(new Boolean(true))));
}
// CHECK#5
if (Boolean(new Boolean(false)) !== true) {
throw new Test262Error('#5: Boolean(new Boolean(false)) === true. Actual: ' + (Boolean(new Boolean(false))));
}
// CHECK#6
if (Boolean(new Boolean()) !== true) {
throw new Test262Error('#6: Boolean(new Boolean()) === true. Actual: ' + (Boolean(new Boolean())));
}
// CHECK#7
if (Boolean(new Array()) !== true) {
throw new Test262Error('#7: Boolean(new Array()) === true. Actual: ' + (Boolean(new Array())));
}
// CHECK#8
if (Boolean(new Number()) !== true) {
throw new Test262Error('#8: Boolean(new Number()) === true. Actual: ' + (Boolean(new Number())));
}
// CHECK#9
if (Boolean(new Number(-0)) !== true) {
throw new Test262Error('#9: Boolean(new Number(-0)) === true. Actual: ' + (Boolean(new Number(-0))));
}
// CHECK#10
if (Boolean(new Number(0)) !== true) {
throw new Test262Error('#10: Boolean(new Number(0)) === true. Actual: ' + (Boolean(new Number(0))));
}
// CHECK#11
if (Boolean(new Number()) !== true) {
throw new Test262Error('#11: Boolean(new Number()) === true. Actual: ' + (Boolean(new Number())));
}
// CHECK#12
if (Boolean(new Number(Number.NaN)) !== true) {
throw new Test262Error('#12: Boolean(new Number(Number.NaN)) === true. Actual: ' + (Boolean(new Number(Number.NaN))));
}
// CHECK#13
if (Boolean(new Number(-1)) !== true) {
throw new Test262Error('#13: Boolean(new Number(-1)) === true. Actual: ' + (Boolean(new Number(-1))));
}
// CHECK#14
if (Boolean(new Number(1)) !== true) {
throw new Test262Error('#14: Boolean(new Number(1)) === true. Actual: ' + (Boolean(new Number(1))));
}
// CHECK#15
if (Boolean(new Number(Number.POSITIVE_INFINITY)) !== true) {
throw new Test262Error('#15: Boolean(new Number(Number.POSITIVE_INFINITY)) === true. Actual: ' + (Boolean(new Number(Number.POSITIVE_INFINITY))));
}
// CHECK#16
if (Boolean(new Number(Number.NEGATIVE_INFINITY)) !== true) {
throw new Test262Error('#16: Boolean(new Number(Number.NEGATIVE_INFINITY)) === true. Actual: ' + (Boolean(new Number(Number.NEGATIVE_INFINITY))));
}
// CHECK#17
if (Boolean(new Function()) !== true) {
throw new Test262Error('#17: Boolean(new Function()) === true. Actual: ' + (Boolean(new Function())));
}
// CHECK#18
if (Boolean(new Date()) !== true) {
throw new Test262Error('#18: Boolean(new Date()) === true. Actual: ' + (Boolean(new Date())));
}
// CHECK#19
if (Boolean(new Date(0)) !== true) {
throw new Test262Error('#19: Boolean(new Date(0)) === true. Actual: ' + (Boolean(new Date(0))));
}
assert.sameValue(Boolean(new Function()), true, 'Boolean(new Function()) must return true');
assert.sameValue(Boolean(new Date()), true, 'Boolean(new Date()) must return true');
assert.sameValue(Boolean(new Date(0)), true, 'Boolean(new Date(0)) must return true');

View File

@ -9,18 +9,18 @@ esid: sec-boolean.prototype
description: Checking Boolean.prototype property
---*/
//CHECK#1
if (typeof Boolean.prototype !== "object") {
throw new Test262Error('#1: typeof Boolean.prototype === "object"');
}
assert.sameValue(
typeof Boolean.prototype,
"object",
'The value of `typeof Boolean.prototype` is expected to be "object"'
);
//CHECK#2
if (Boolean.prototype != false) {
throw new Test262Error('#2: Boolean.prototype == false');
}
assert(Boolean.prototype == false, 'The value of Boolean.prototype is expected to be false');
delete Boolean.prototype.toString;
if (Boolean.prototype.toString() !== "[object Boolean]") {
throw new Test262Error('#3: The [[Class]] property of the Boolean prototype object is set to "Boolean"');
}
assert.sameValue(
Boolean.prototype.toString(),
"[object Boolean]",
'Boolean.prototype.toString() must return "[object Boolean]"'
);

View File

@ -11,6 +11,4 @@ includes: [propertyHelper.js]
// CHECK#1
var x = Boolean.prototype;
verifyNotWritable(Boolean, "prototype", null, 1);
if (Boolean.prototype !== x) {
throw new Test262Error('#1: Boolean.prototype has the attribute ReadOnly');
}
assert.sameValue(Boolean.prototype, x, 'The value of Boolean.prototype is expected to equal the value of x');

View File

@ -6,16 +6,12 @@ info: Boolean.prototype has the attribute DontDelete
esid: sec-boolean.prototype
description: Checking if deleting the Boolean.prototype property fails
includes: [propertyHelper.js]
flags: [onlyStrict]
---*/
// CHECK#1
verifyNotConfigurable(Boolean, "prototype");
try {
if (delete Boolean.prototype !== false) {
throw new Test262Error('#1: Boolean.prototype has the attribute DontDelete');
}
} catch (e) {
if (e instanceof Test262Error) throw e;
assert(e instanceof TypeError);
}
assert.throws(TypeError, () => {
delete Boolean.prototype;
});

View File

@ -7,13 +7,11 @@ esid: sec-boolean.prototype
description: Checking if enumerating the Boolean.prototype property fails
---*/
//CHECK#1
for (x in Boolean) {
if (x === "prototype") {
throw new Test262Error('#1: Boolean.prototype has the attribute DontEnum');
}
assert.notSameValue(x, "prototype", 'The value of x is not "prototype"');
}
if (Boolean.propertyIsEnumerable('prototype')) {
throw new Test262Error('#2: Boolean.prototype has the attribute DontEnum');
}
assert(
!Boolean.propertyIsEnumerable('prototype'),
'The value of !Boolean.propertyIsEnumerable(\'prototype\') is expected to be true'
);

View File

@ -1,26 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
The Boolean prototype object is itself a Boolean object
(its [[Class]] is "Boolean") whose value is false
esid: sec-properties-of-the-boolean-prototype-object
description: Checking type and value of Boolean.prototype
---*/
//CHECK#1
if (typeof Boolean.prototype !== "object") {
throw new Test262Error('#1: typeof Boolean.prototype === "object"');
}
//CHECK#2
if (Boolean.prototype != false) {
throw new Test262Error('#2: Boolean.prototype == false');
}
delete Boolean.prototype.toString;
if (Boolean.prototype.toString() !== "[object Boolean]") {
throw new Test262Error('#3: The [[Class]] property of the Boolean prototype object is set to "Boolean"');
}

View File

@ -9,7 +9,7 @@ esid: sec-properties-of-the-boolean-prototype-object
description: Checking Object.prototype.isPrototypeOf(Boolean.prototype)
---*/
//CHECK#1
if (!Object.prototype.isPrototypeOf(Boolean.prototype)) {
throw new Test262Error('#1: Object prototype object is the prototype of Boolean prototype object');
}
assert(
Object.prototype.isPrototypeOf(Boolean.prototype),
'Object.prototype.isPrototypeOf(Boolean.prototype) must return true'
);

View File

@ -8,8 +8,8 @@ info: |
esid: sec-boolean-constructor
description: Compare Boolean.prototype.constructor with Boolean
---*/
//CHECK#1
if (Boolean.prototype.constructor !== Boolean) {
throw new Test262Error('#1: Boolean.prototype.constructor === Boolean');
}
assert.sameValue(
Boolean.prototype.constructor,
Boolean,
'The value of Boolean.prototype.constructor is expected to equal the value of Boolean'
);

View File

@ -10,38 +10,15 @@ info: |
es5id: 15.6.4.2_A1_T1
description: no arguments
---*/
assert.sameValue(Boolean.prototype.toString(), "false", 'Boolean.prototype.toString() must return "false"');
assert.sameValue((new Boolean()).toString(), "false", '(new Boolean()).toString() must return "false"');
assert.sameValue((new Boolean(false)).toString(), "false", '(new Boolean(false)).toString() must return "false"');
assert.sameValue((new Boolean(true)).toString(), "true", '(new Boolean(true)).toString() must return "true"');
assert.sameValue((new Boolean(1)).toString(), "true", '(new Boolean(1)).toString() must return "true"');
assert.sameValue((new Boolean(0)).toString(), "false", '(new Boolean(0)).toString() must return "false"');
//CHECK#1
if (Boolean.prototype.toString() !== "false") {
throw new Test262Error('#1: Boolean.prototype.toString() === "false"');
}
//CHECK#2
if ((new Boolean()).toString() !== "false") {
throw new Test262Error('#2: (new Boolean()).toString() === "false"');
}
//CHECK#3
if ((new Boolean(false)).toString() !== "false") {
throw new Test262Error('#3: (new Boolean(false)).toString() === "false"');
}
//CHECK#4
if ((new Boolean(true)).toString() !== "true") {
throw new Test262Error('#4: (new Boolean(true)).toString() === "true"');
}
//CHECK#5
if ((new Boolean(1)).toString() !== "true") {
throw new Test262Error('#5: (new Boolean(1)).toString() === "true"');
}
//CHECK#6
if ((new Boolean(0)).toString() !== "false") {
throw new Test262Error('#6: (new Boolean(0)).toString() === "false"');
}
//CHECK#7
if ((new Boolean(new Object())).toString() !== "true") {
throw new Test262Error('#7: (new Boolean(new Object())).toString() === "true"');
}
assert.sameValue(
(new Boolean(new Object())).toString(),
"true",
'(new Boolean(new Object())).toString() must return "true"'
);

View File

@ -10,38 +10,26 @@ info: |
es5id: 15.6.4.2_A1_T2
description: with some argument
---*/
assert.sameValue(Boolean.prototype.toString(true), "false", 'Boolean.prototype.toString(true) must return "false"');
assert.sameValue((new Boolean()).toString(true), "false", '(new Boolean()).toString(true) must return "false"');
//CHECK#1
if (Boolean.prototype.toString(true) !== "false") {
throw new Test262Error('#1: Boolean.prototype.toString(true) === "false"');
}
assert.sameValue(
(new Boolean(false)).toString(true),
"false",
'(new Boolean(false)).toString(true) must return "false"'
);
//CHECK#2
if ((new Boolean()).toString(true) !== "false") {
throw new Test262Error('#2: (new Boolean()).toString(true) === "false"');
}
assert.sameValue(
(new Boolean(true)).toString(false),
"true",
'(new Boolean(true)).toString(false) must return "true"'
);
//CHECK#3
if ((new Boolean(false)).toString(true) !== "false") {
throw new Test262Error('#3: (new Boolean(false)).toString(true) === "false"');
}
assert.sameValue((new Boolean(1)).toString(false), "true", '(new Boolean(1)).toString(false) must return "true"');
assert.sameValue((new Boolean(0)).toString(true), "false", '(new Boolean(0)).toString(true) must return "false"');
//CHECK#4
if ((new Boolean(true)).toString(false) !== "true") {
throw new Test262Error('#4: (new Boolean(true)).toString(false) === "true"');
}
//CHECK#5
if ((new Boolean(1)).toString(false) !== "true") {
throw new Test262Error('#5: (new Boolean(1)).toString(false) === "true"');
}
//CHECK#6
if ((new Boolean(0)).toString(true) !== "false") {
throw new Test262Error('#6: (new Boolean(0)).toString(true) === "false"');
}
//CHECK#7
if ((new Boolean(new Object())).toString(false) !== "true") {
throw new Test262Error('#7: (new Boolean(new Object())).toString(false) === "true"');
}
assert.sameValue(
(new Boolean(new Object())).toString(false),
"true",
'(new Boolean(new Object())).toString(false) must return "true"'
);

View File

@ -11,28 +11,16 @@ es5id: 15.6.4.2_A2_T1
description: transferring to the String objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new String();
s1.toString = Boolean.prototype.toString;
var v1 = s1.toString();
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
throw new Test262Error();
});
//CHECK#2
try {
assert.throws(TypeError, () => {
var s2 = new String();
s2.myToString = Boolean.prototype.toString;
var v2 = s2.myToString();
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
throw new Test262Error();
});

View File

@ -11,28 +11,16 @@ es5id: 15.6.4.2_A2_T2
description: transferring to the Number objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new Number();
s1.toString = Boolean.prototype.toString;
var v1 = s1.toString();
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.toString();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new Number();
s2.myToString = Boolean.prototype.toString;
var v2 = s2.myToString();
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myToString();
throw new Test262Error();
});

View File

@ -11,28 +11,16 @@ es5id: 15.6.4.2_A2_T3
description: transferring to the Date objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new Date();
s1.toString = Boolean.prototype.toString;
var v1 = s1.toString();
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.toString();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new Date();
s2.myToString = Boolean.prototype.toString;
var v2 = s2.myToString();
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myToString();
throw new Test262Error();
});

View File

@ -11,28 +11,17 @@ es5id: 15.6.4.2_A2_T4
description: transferring to the Object objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new Object();
s1.toString = Boolean.prototype.toString;
var v1 = s1.toString();
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.toString();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new Object();
s2.myToString = Boolean.prototype.toString;
var v2 = s2.myToString();
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myToString();
throw new Test262Error();
});

View File

@ -11,32 +11,20 @@ es5id: 15.6.4.2_A2_T5
description: transferring to the other objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = {
x: 1
};
s1.toString = Boolean.prototype.toString;
var v1 = s1.toString();
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.toString();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = {
x: 1
};
s2.myToString = Boolean.prototype.toString;
var v2 = s2.myToString();
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.toString on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myToString();
throw new Test262Error();
});

View File

@ -6,33 +6,14 @@ info: Boolean.prototype.valueOf() returns this boolean value
esid: sec-boolean.prototype.valueof
description: no arguments
---*/
assert.sameValue(Boolean.prototype.valueOf(), false, 'Boolean.prototype.valueOf() must return false');
assert.sameValue((new Boolean()).valueOf(), false, '(new Boolean()).valueOf() must return false');
assert.sameValue((new Boolean(0)).valueOf(), false, '(new Boolean(0)).valueOf() must return false');
assert.sameValue((new Boolean(-1)).valueOf(), true, '(new Boolean(-1)).valueOf() must return true');
assert.sameValue((new Boolean(1)).valueOf(), true, '(new Boolean(1)).valueOf() must return true');
//CHECK#1
if (Boolean.prototype.valueOf() !== false) {
throw new Test262Error('#1: Boolean.prototype.valueOf() === false');
}
//CHECK#2
if ((new Boolean()).valueOf() !== false) {
throw new Test262Error('#2: (new Boolean()).valueOf() === false');
}
//CHECK#3
if ((new Boolean(0)).valueOf() !== false) {
throw new Test262Error('#3: (new Boolean(0)).valueOf() === false');
}
//CHECK#4
if ((new Boolean(-1)).valueOf() !== true) {
throw new Test262Error('#4: (new Boolean(-1)).valueOf() === true');
}
//CHECK#5
if ((new Boolean(1)).valueOf() !== true) {
throw new Test262Error('#5: (new Boolean(1)).valueOf() === true');
}
//CHECK#6
if ((new Boolean(new Object())).valueOf() !== true) {
throw new Test262Error('#6: (new Boolean(new Object())).valueOf() === true');
}
assert.sameValue(
(new Boolean(new Object())).valueOf(),
true,
'(new Boolean(new Object())).valueOf() must return true'
);

View File

@ -6,33 +6,14 @@ info: Boolean.prototype.valueOf() returns this boolean value
esid: sec-boolean.prototype.valueof
description: calling with argument
---*/
assert.sameValue(Boolean.prototype.valueOf(true), false, 'Boolean.prototype.valueOf(true) must return false');
assert.sameValue((new Boolean()).valueOf(true), false, '(new Boolean()).valueOf(true) must return false');
assert.sameValue((new Boolean(0)).valueOf(true), false, '(new Boolean(0)).valueOf(true) must return false');
assert.sameValue((new Boolean(-1)).valueOf(false), true, '(new Boolean(-1)).valueOf(false) must return true');
assert.sameValue((new Boolean(1)).valueOf(false), true, '(new Boolean(1)).valueOf(false) must return true');
//CHECK#1
if (Boolean.prototype.valueOf(true) !== false) {
throw new Test262Error('#1: Boolean.prototype.valueOf(true) === false');
}
//CHECK#2
if ((new Boolean()).valueOf(true) !== false) {
throw new Test262Error('#2: (new Boolean()).valueOf(true) === false');
}
//CHECK#3
if ((new Boolean(0)).valueOf(true) !== false) {
throw new Test262Error('#3: (new Boolean(0)).valueOf(true) === false');
}
//CHECK#4
if ((new Boolean(-1)).valueOf(false) !== true) {
throw new Test262Error('#4: (new Boolean(-1)).valueOf(false) === true');
}
//CHECK#5
if ((new Boolean(1)).valueOf(false) !== true) {
throw new Test262Error('#5: (new Boolean(1)).valueOf(false) === true');
}
//CHECK#6
if ((new Boolean(new Object())).valueOf(false) !== true) {
throw new Test262Error('#6: (new Boolean(new Object())).valueOf(false) === true');
}
assert.sameValue(
(new Boolean(new Object())).valueOf(false),
true,
'(new Boolean(new Object())).valueOf(false) must return true'
);

View File

@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof
description: transferring to the String objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new String();
s1.valueOf = Boolean.prototype.valueOf;
var v1 = s1.valueOf();
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.valueOf();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new String();
s2.myValueOf = Boolean.prototype.valueOf;
var v2 = s2.myValueOf();
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myvalueOf = Boolean.prototype.valueOf;
s2.myvalueOf();
throw new Test262Error();
});

View File

@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof
description: transferring to the Number objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new Number();
s1.valueOf = Boolean.prototype.valueOf;
var v1 = s1.valueOf();
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.valueOf();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new Number();
s2.myValueOf = Boolean.prototype.valueOf;
var v2 = s2.myValueOf();
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myvalueOf = Boolean.prototype.valueOf;
s2.myvalueOf();
throw new Test262Error();
});

View File

@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof
description: transferring to the Date objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new Date();
s1.valueOf = Boolean.prototype.valueOf;
var v1 = s1.valueOf();
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.valueOf();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new Date();
s2.myValueOf = Boolean.prototype.valueOf;
var v2 = s2.myValueOf();
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myvalueOf = Boolean.prototype.valueOf;
s2.myvalueOf();
throw new Test262Error();
});

View File

@ -10,28 +10,16 @@ esid: sec-boolean.prototype.valueof
description: transferring to the Object objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = new Object();
s1.valueOf = Boolean.prototype.valueOf;
var v1 = s1.valueOf();
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.valueOf();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = new Object();
s2.myValueOf = Boolean.prototype.valueOf;
var v2 = s2.myValueOf();
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myvalueOf = Boolean.prototype.valueOf;
s2.myvalueOf();
throw new Test262Error();
});

View File

@ -10,32 +10,20 @@ esid: sec-boolean.prototype.valueof
description: transferring to the other objects
---*/
//CHECK#1
try {
assert.throws(TypeError, () => {
var s1 = {
x: 1
};
s1.valueOf = Boolean.prototype.valueOf;
var v1 = s1.valueOf();
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#1: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s1.valueOf();
throw new Test262Error();
});
//CHECK#1
try {
assert.throws(TypeError, () => {
var s2 = {
x: 1
};
s2.myValueOf = Boolean.prototype.valueOf;
var v2 = s2.myValueOf();
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError');
}
catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2: Boolean.prototype.valueOf on not a Boolean object should throw TypeError, not ' + e);
}
}
s2.myvalueOf = Boolean.prototype.valueOf;
s2.myvalueOf();
throw new Test262Error();
});