| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'number-002.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
var SECTION = "number-002"; |
| 23 |
var VERSION = "JS1_4"; |
| 24 |
var TITLE = "Exceptions for Number.valueOf()"; |
| 25 |
|
| 26 |
startTest(); |
| 27 |
writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); |
| 28 |
|
| 29 |
var result = "Failed"; |
| 30 |
var exception = "No exception thrown"; |
| 31 |
var expect = "Passed"; |
| 32 |
|
| 33 |
try { |
| 34 |
object= new Object(); |
| 35 |
object.toString = Number.prototype.valueOf; |
| 36 |
result = object.toString(); |
| 37 |
} catch ( e ) { |
| 38 |
result = expect; |
| 39 |
exception = e.toString(); |
| 40 |
} |
| 41 |
|
| 42 |
new TestCase( |
| 43 |
SECTION, |
| 44 |
"object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" + |
| 45 |
" (threw " + exception +")", |
| 46 |
expect, |
| 47 |
result ); |
| 48 |
|
| 49 |
test(); |