Debian Codegraph @

rhino/testsrc/tests/ecma_2/Exceptions/date-002.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'date-002.js';
7
8 /**
9 File Name: date-002.js
10 Corresponds To: 15.9.5.23-3-n.js
11 ECMA Section: 15.9.5.23
12 Description: Date.prototype.setTime
13
14 1. If the this value is not a Date object, generate a runtime error.
15 2. Call ToNumber(time).
16 3. Call TimeClip(Result(1)).
17 4. Set the [[Value]] property of the this value to Result(2).
18 5. Return the value of the [[Value]] property of the this value.
19
20 Author: [email protected]
21 Date: 12 november 1997
22 */
23 var SECTION = "date-002";
24 var VERSION = "JS1_4";
25 var TITLE = "Date.prototype.setTime()";
26
27 startTest();
28 writeHeaderToLog( SECTION + " "+ TITLE);
29
30 var result = "Failed";
31 var exception = "No exception thrown";
32 var expect = "Passed";
33
34 try {
35 var MYDATE = new MyDate();
36 result = MYDATE.setTime(0);
37 } catch ( e ) {
38 result = expect;
39 exception = e.toString();
40 }
41
42 new TestCase(
43 SECTION,
44 "MYDATE = new MyDate(); MYDATE.setTime(0)" +
45 " (threw " + exception +")",
46 expect,
47 result );
48
49 test();
50
51 function MyDate(value) {
52 this.value = value;
53 this.setTime = Date.prototype.setTime;
54 return this;
55 }