| 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 |
|
| 13 |
//CHECK#1 |
| 14 |
if (typeof Date() !== "string") { |
| 15 |
$ERROR('#1: typeof Date() should be "string", actual is ' + (typeof Date())); |
| 16 |
} |
| 17 |
|
| 18 |
//CHECK#2 |
| 19 |
if (typeof Date(1) !== "string") { |
| 20 |
$ERROR('#2: typeof Date(1) should be "string", actual is ' + (typeof Date(1))); |
| 21 |
} |
| 22 |
|
| 23 |
//CHECK#3 |
| 24 |
if (typeof Date(1970, 1) !== "string") { |
| 25 |
$ERROR('#3: typeof Date(1970, 1) should be "string", actual is ' + (typeof Date(1970, 1))); |
| 26 |
} |
| 27 |
|
| 28 |
//CHECK#4 |
| 29 |
if (typeof Date(1970, 1, 1) !== "string") { |
| 30 |
$ERROR('#4: typeof Date(1970, 1, 1) should be "string", actual is ' + (typeof Date(1970, 1, 1))); |
| 31 |
} |
| 32 |
|
| 33 |
//CHECK#5 |
| 34 |
if (typeof Date(1970, 1, 1, 1) !== "string") { |
| 35 |
$ERROR('#5: typeof Date(1970, 1, 1, 1) should be "string", actual is ' + (typeof Date(1970, 1, 1, 1))); |
| 36 |
} |
| 37 |
|
| 38 |
//CHECK#6 |
| 39 |
if (typeof Date(1970, 1, 1, 1) !== "string") { |
| 40 |
$ERROR('#7: typeof Date(1970, 1, 1, 1) should be "string", actual is ' + (typeof Date(1970, 1, 1, 1))); |
| 41 |
} |
| 42 |
|
| 43 |
//CHECK#8 |
| 44 |
if (typeof Date(1970, 1, 1, 1, 0) !== "string") { |
| 45 |
$ERROR('#8: typeof Date(1970, 1, 1, 1, 0) should be "string", actual is ' + (typeof Date(1970, 1, 1, 1, 0))); |
| 46 |
} |
| 47 |
|
| 48 |
//CHECK#9 |
| 49 |
if (typeof Date(1970, 1, 1, 1, 0, 0) !== "string") { |
| 50 |
$ERROR('#9: typeof Date(1970, 1, 1, 1, 0, 0) should be "string", actual is ' + (typeof Date(1970, 1, 1, 1, 0, 0))); |
| 51 |
} |
| 52 |
|
| 53 |
//CHECK#10 |
| 54 |
if (typeof Date(1970, 1, 1, 1, 0, 0, 0) !== "string") { |
| 55 |
$ERROR('#10: typeof Date(1970, 1, 1, 1, 0, 0, 0) should be "string", actual is ' + (typeof Date(1970, 1, 1, 1, 0, 0, 0))); |
| 56 |
} |
| 57 |
|
| 58 |
//CHECK#11 |
| 59 |
if (typeof Date(Number.NaN) !== "string") { |
| 60 |
$ERROR('#11: typeof Date(Number.NaN) should be "string", actual is ' + (typeof Date(Number.NaN))); |
| 61 |
} |
| 62 |
|
| 63 |
//CHECK#12 |
| 64 |
if (typeof Date(Number.POSITIVE_INFINITY) !== "string") { |
| 65 |
$ERROR('#12: typeof Date(Number.POSITIVE_INFINITY) should be "string", actual is ' + (typeof Date(Number.POSITIVE_INFINITY))); |
| 66 |
} |
| 67 |
|
| 68 |
//CHECK#13 |
| 69 |
if (typeof Date(Number.NEGATIVE_INFINITY) !== "string") { |
| 70 |
$ERROR('#13: typeof Date(Number.NEGATIVE_INFINITY) should be "string", actual is ' + (typeof Date(Number.NEGATIVE_INFINITY))); |
| 71 |
} |
| 72 |
|
| 73 |
//CHECK#14 |
| 74 |
if (typeof Date(undefined) !== "string") { |
| 75 |
$ERROR('#14: typeof Date(undefined) should be "string", actual is ' + (typeof Date(undefined))); |
| 76 |
} |
| 77 |
|
| 78 |
//CHECK#15 |
| 79 |
if (typeof Date(null) !== "string") { |
| 80 |
$ERROR('#15: typeof Date(null) should be "string", actual is ' + (typeof Date(null))); |
| 81 |
} |