Debian Codegraph @

js/src/tests/test262/built-ins/Date/S15.9.2.1_A1.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-date-year-month-date-hours-minutes-seconds-ms
6 info: |
7 When Date is called as a function rather than as a constructor,
8 it should be "string" representing the current time (UTC)
9 es5id: 15.9.2.1_A1
10 description: Checking type of returned value
11 ---*/
12 assert.sameValue(typeof Date(), "string", 'The value of `typeof Date()` is expected to be "string"');
13 assert.sameValue(typeof Date(1), "string", 'The value of `typeof Date(1)` is expected to be "string"');
14 assert.sameValue(typeof Date(1970, 1), "string", 'The value of `typeof Date(1970, 1)` is expected to be "string"');
15
16 assert.sameValue(
17 typeof Date(1970, 1, 1),
18 "string",
19 'The value of `typeof Date(1970, 1, 1)` is expected to be "string"'
20 );
21
22 assert.sameValue(
23 typeof Date(1970, 1, 1, 1),
24 "string",
25 'The value of `typeof Date(1970, 1, 1, 1)` is expected to be "string"'
26 );
27
28 assert.sameValue(
29 typeof Date(1970, 1, 1, 1),
30 "string",
31 'The value of `typeof Date(1970, 1, 1, 1)` is expected to be "string"'
32 );
33
34 assert.sameValue(
35 typeof Date(1970, 1, 1, 1, 0),
36 "string",
37 'The value of `typeof Date(1970, 1, 1, 1, 0)` is expected to be "string"'
38 );
39
40 assert.sameValue(
41 typeof Date(1970, 1, 1, 1, 0, 0),
42 "string",
43 'The value of `typeof Date(1970, 1, 1, 1, 0, 0)` is expected to be "string"'
44 );
45
46 assert.sameValue(
47 typeof Date(1970, 1, 1, 1, 0, 0, 0),
48 "string",
49 'The value of `typeof Date(1970, 1, 1, 1, 0, 0, 0)` is expected to be "string"'
50 );
51
52 assert.sameValue(
53 typeof Date(Number.NaN),
54 "string",
55 'The value of `typeof Date(Number.NaN)` is expected to be "string"'
56 );
57
58 assert.sameValue(
59 typeof Date(Number.POSITIVE_INFINITY),
60 "string",
61 'The value of `typeof Date(Number.POSITIVE_INFINITY)` is expected to be "string"'
62 );
63
64 assert.sameValue(
65 typeof Date(Number.NEGATIVE_INFINITY),
66 "string",
67 'The value of `typeof Date(Number.NEGATIVE_INFINITY)` is expected to be "string"'
68 );
69
70 assert.sameValue(typeof Date(undefined), "string", 'The value of `typeof Date(undefined)` is expected to be "string"');
71 assert.sameValue(typeof Date(null), "string", 'The value of `typeof Date(null)` is expected to be "string"');
72
73 reportCompare(0, 0);