1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
6 The valueOf function is not generic, it cannot be transferred
7 to other kinds of objects for use as a method and there is should be
8 a TypeError exception if its this value is not a Number object
10 description: transferring to the Boolean objects
14 var s1 = new Boolean();
15 s1.valueOf = Number.prototype.valueOf;
16 var v1 = s1.valueOf();
17 throw new Test262Error('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
20 assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
24 var s2 = new Boolean();
25 s2.myValueOf = Number.prototype.valueOf;
26 var v2 = s2.myValueOf();
27 throw new Test262Error('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
30 assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');