]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Exceptions/date-004.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma_2 / Exceptions / date-004.js
1 /**
2 File Name: date-004.js
3 Corresponds To: 15.9.5.4-2-n.js
4 ECMA Section: 15.9.5.4-1 Date.prototype.getTime
5 Description:
6
7 1. If the this value is not an object whose [[Class]] property is "Date",
8 generate a runtime error.
9 2. Return this time value.
10 Author: christine@netscape.com
11 Date: 12 november 1997
12 */
13 var SECTION = "date-004";
14 var VERSION = "JS1_4";
15 var TITLE = "Date.prototype.getTime";
16
17 startTest();
18 writeHeaderToLog( SECTION + " "+ TITLE);
19
20 var tc = 0;
21 var testcases = new Array();
22
23 var result = "Failed";
24 var exception = "No exception thrown";
25 var expect = "Passed";
26
27 try {
28 var MYDATE = new MyDate();
29 result = MYDATE.getTime();
30 } catch ( e ) {
31 result = expect;
32 exception = e.toString();
33 }
34
35 testcases[tc++] = new TestCase(
36 SECTION,
37 "MYDATE = new MyDate(); MYDATE.getTime()" +
38 " (threw " + exception +")",
39 expect,
40 result );
41
42 test();
43
44 function MyDate( value ) {
45 this.value = value;
46 this.getTime = Date.prototype.getTime;
47 }