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 other objects
17 s1.valueOf = Number.prototype.valueOf;
18 var v1 = s1.valueOf();
19 throw new Test262Error('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
22 assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
29 s2.myValueOf = Number.prototype.valueOf;
30 var v2 = s2.myValueOf();
31 throw new Test262Error('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
34 assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');