S15.6.1.1_A1_T5.js (1436B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Returns a boolean value (not a Boolean object) computed by 7 ToBoolean(value) 8 esid: sec-terms-and-definitions-boolean-value 9 description: Used various assigning values to any variable as argument 10 ---*/ 11 12 var x; 13 14 assert.sameValue(typeof Boolean(x = 0), "boolean", 'The value of `typeof Boolean(x = 0)` is expected to be "boolean"'); 15 assert.sameValue(Boolean(x = 0), false, 'Boolean(x = 0) must return false'); 16 assert.sameValue(typeof Boolean(x = 1), "boolean", 'The value of `typeof Boolean(x = 1)` is expected to be "boolean"'); 17 assert.sameValue(Boolean(x = 1), true, 'Boolean(x = 1) must return true'); 18 19 assert.sameValue( 20 typeof Boolean(x = false), 21 "boolean", 22 'The value of `typeof Boolean(x = false)` is expected to be "boolean"' 23 ); 24 25 assert.sameValue(Boolean(x = false), false, 'Boolean(x = false) must return false'); 26 27 assert.sameValue( 28 typeof Boolean(x = true), 29 "boolean", 30 'The value of `typeof Boolean(x = true)` is expected to be "boolean"' 31 ); 32 33 assert.sameValue(Boolean(x = true), true, 'Boolean(x = true) must return true'); 34 35 assert.sameValue( 36 typeof Boolean(x = null), 37 "boolean", 38 'The value of `typeof Boolean(x = null)` is expected to be "boolean"' 39 ); 40 41 assert.sameValue(Boolean(x = null), false, 'Boolean(x = null) must return false'); 42 43 reportCompare(0, 0);