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