Debian Codegraph @

rhino/testsrc/tests/ecma_2/Exceptions/date-004.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-004.js';
7
8 /**
9 File Name: date-004.js
10 Corresponds To: 15.9.5.4-2-n.js
11 ECMA Section: 15.9.5.4-1 Date.prototype.getTime
12 Description:
13
14 1. If the this value is not an object whose [[Class]] property is "Date",
15 generate a runtime error.
16 2. Return this time value.
17 Author: [email protected]
18 Date: 12 november 1997
19 */
20 var SECTION = "date-004";
21 var VERSION = "JS1_4";
22 var TITLE = "Date.prototype.getTime";
23
24 startTest();
25 writeHeaderToLog( SECTION + " "+ TITLE);
26
27 var result = "Failed";
28 var exception = "No exception thrown";
29 var expect = "Passed";
30
31 try {
32 var MYDATE = new MyDate();
33 result = MYDATE.getTime();
34 } catch ( e ) {
35 result = expect;
36 exception = e.toString();
37 }
38
39 new TestCase(
40 SECTION,
41 "MYDATE = new MyDate(); MYDATE.getTime()" +
42 " (threw " + exception +")",
43 expect,
44 result );
45
46 test();
47
48 function MyDate( value ) {
49 this.value = value;
50 this.getTime = Date.prototype.getTime;
51 }