2011-09-07 08:35:18 +02:00
|
|
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
|
|
|
info: Result of boolean conversion from object is true
|
2017-07-27 18:17:54 +02:00
|
|
|
esid: sec-toboolean
|
2014-07-22 01:09:02 +02:00
|
|
|
description: Different objects convert to Boolean by explicit transformation
|
|
|
|
---*/
|
2011-09-07 08:35:18 +02:00
|
|
|
|
2021-08-11 17:07:49 +02:00
|
|
|
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');
|
|
|
|
|
|
|
|
assert.sameValue(
|
|
|
|
Boolean(new Number(Number.POSITIVE_INFINITY)),
|
|
|
|
true,
|
|
|
|
'Boolean(new Number(Number.POSITIVE_INFINITY)) must return true'
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.sameValue(
|
|
|
|
Boolean(new Number(Number.NEGATIVE_INFINITY)),
|
|
|
|
true,
|
|
|
|
'Boolean(new Number(Number.NEGATIVE_INFINITY)) must return true'
|
|
|
|
);
|
|
|
|
|
|
|
|
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');
|