summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T2.js
blob: 28d0045fb94b048c5fcef59b55322b9b7e64e165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
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');

assert.sameValue(
  (new Boolean(new Object())).valueOf(false),
  true,
  '(new Boolean(new Object())).valueOf(false) must return true'
);

reportCompare(0, 0);