From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../built-ins/Date/prototype/S15.9.4.1_A1_T1.js | 19 +++ .../built-ins/Date/prototype/S15.9.4.1_A1_T2.js | 30 +++++ .../built-ins/Date/prototype/S15.9.4.1_A1_T3.js | 22 ++++ .../built-ins/Date/prototype/S15.9.5_A01_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A02_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A03_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A04_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A05_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A06_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A07_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A08_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A09_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A10_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A11_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A12_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A13_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A14_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A15_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A16_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A17_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A18_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A19_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A20_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A21_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A22_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A23_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A24_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A25_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A26_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A27_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A28_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A29_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A30_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A31_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A32_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A33_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A34_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A35_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A36_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A37_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A38_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A39_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A40_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A41_T1.js | 15 +++ .../built-ins/Date/prototype/S15.9.5_A42_T1.js | 15 +++ .../Date/prototype/Symbol.toPrimitive/browser.js | 0 .../Symbol.toPrimitive/called-as-function.js | 35 ++++++ .../hint-default-first-invalid.js | 40 +++++++ .../hint-default-first-non-callable.js | 35 ++++++ .../Symbol.toPrimitive/hint-default-first-valid.js | 38 ++++++ .../hint-default-no-callables.js | 28 +++++ .../prototype/Symbol.toPrimitive/hint-invalid.js | 57 +++++++++ .../hint-number-first-invalid.js | 40 +++++++ .../hint-number-first-non-callable.js | 35 ++++++ .../Symbol.toPrimitive/hint-number-first-valid.js | 38 ++++++ .../Symbol.toPrimitive/hint-number-no-callables.js | 28 +++++ .../hint-string-first-invalid.js | 40 +++++++ .../hint-string-first-non-callable.js | 35 ++++++ .../Symbol.toPrimitive/hint-string-first-valid.js | 38 ++++++ .../Symbol.toPrimitive/hint-string-no-callables.js | 28 +++++ .../Date/prototype/Symbol.toPrimitive/length.js | 29 +++++ .../Date/prototype/Symbol.toPrimitive/name.js | 28 +++++ .../Date/prototype/Symbol.toPrimitive/prop-desc.js | 18 +++ .../Date/prototype/Symbol.toPrimitive/shell.js | 0 .../Symbol.toPrimitive/this-val-non-obj.js | 34 ++++++ .../test262/built-ins/Date/prototype/browser.js | 0 .../Date/prototype/constructor/S15.9.5.1_A1_T1.js | 25 ++++ .../Date/prototype/constructor/S15.9.5.1_A1_T2.js | 22 ++++ .../Date/prototype/constructor/S15.9.5.1_A1_T3.js | 20 ++++ .../Date/prototype/constructor/S15.9.5.1_A2_T1.js | 21 ++++ .../Date/prototype/constructor/S15.9.5.1_A3_T1.js | 24 ++++ .../Date/prototype/constructor/S15.9.5.1_A3_T2.js | 24 ++++ .../Date/prototype/constructor/S15.9.5.1_A3_T3.js | 22 ++++ .../Date/prototype/constructor/browser.js | 0 .../built-ins/Date/prototype/constructor/shell.js | 0 .../Date/prototype/getDate/S15.9.5.14_A1_T1.js | 25 ++++ .../Date/prototype/getDate/S15.9.5.14_A1_T2.js | 18 +++ .../Date/prototype/getDate/S15.9.5.14_A1_T3.js | 20 ++++ .../Date/prototype/getDate/S15.9.5.14_A2_T1.js | 17 +++ .../Date/prototype/getDate/S15.9.5.14_A3_T1.js | 24 ++++ .../Date/prototype/getDate/S15.9.5.14_A3_T2.js | 24 ++++ .../Date/prototype/getDate/S15.9.5.14_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/getDate/browser.js | 0 .../built-ins/Date/prototype/getDate/name.js | 28 +++++ .../Date/prototype/getDate/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getDate/shell.js | 0 .../prototype/getDate/this-value-invalid-date.js | 13 ++ .../Date/prototype/getDate/this-value-non-date.js | 36 ++++++ .../prototype/getDate/this-value-non-object.js | 46 ++++++++ .../prototype/getDate/this-value-valid-date.js | 42 +++++++ .../Date/prototype/getDay/S15.9.5.16_A1_T1.js | 26 ++++ .../Date/prototype/getDay/S15.9.5.16_A1_T2.js | 19 +++ .../Date/prototype/getDay/S15.9.5.16_A1_T3.js | 21 ++++ .../Date/prototype/getDay/S15.9.5.16_A2_T1.js | 18 +++ .../Date/prototype/getDay/S15.9.5.16_A3_T1.js | 25 ++++ .../Date/prototype/getDay/S15.9.5.16_A3_T2.js | 25 ++++ .../Date/prototype/getDay/S15.9.5.16_A3_T3.js | 23 ++++ .../built-ins/Date/prototype/getDay/browser.js | 0 .../built-ins/Date/prototype/getDay/name.js | 28 +++++ .../Date/prototype/getDay/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getDay/shell.js | 0 .../prototype/getDay/this-value-invalid-date.js | 13 ++ .../Date/prototype/getDay/this-value-non-date.js | 36 ++++++ .../Date/prototype/getDay/this-value-non-object.js | 46 ++++++++ .../Date/prototype/getDay/this-value-valid-date.js | 42 +++++++ .../Date/prototype/getFullYear/S15.9.5.10_A1_T1.js | 26 ++++ .../Date/prototype/getFullYear/S15.9.5.10_A1_T2.js | 23 ++++ .../Date/prototype/getFullYear/S15.9.5.10_A1_T3.js | 21 ++++ .../Date/prototype/getFullYear/S15.9.5.10_A2_T1.js | 22 ++++ .../Date/prototype/getFullYear/S15.9.5.10_A3_T1.js | 25 ++++ .../Date/prototype/getFullYear/S15.9.5.10_A3_T2.js | 25 ++++ .../Date/prototype/getFullYear/S15.9.5.10_A3_T3.js | 23 ++++ .../Date/prototype/getFullYear/browser.js | 0 .../built-ins/Date/prototype/getFullYear/name.js | 28 +++++ .../prototype/getFullYear/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getFullYear/shell.js | 0 .../getFullYear/this-value-invalid-date.js | 13 ++ .../prototype/getFullYear/this-value-non-date.js | 36 ++++++ .../prototype/getFullYear/this-value-non-object.js | 46 ++++++++ .../prototype/getFullYear/this-value-valid-date.js | 27 +++++ .../Date/prototype/getHours/S15.9.5.18_A1_T1.js | 26 ++++ .../Date/prototype/getHours/S15.9.5.18_A1_T2.js | 19 +++ .../Date/prototype/getHours/S15.9.5.18_A1_T3.js | 21 ++++ .../Date/prototype/getHours/S15.9.5.18_A2_T1.js | 18 +++ .../Date/prototype/getHours/S15.9.5.18_A3_T1.js | 25 ++++ .../Date/prototype/getHours/S15.9.5.18_A3_T2.js | 25 ++++ .../Date/prototype/getHours/S15.9.5.18_A3_T3.js | 23 ++++ .../built-ins/Date/prototype/getHours/browser.js | 0 .../built-ins/Date/prototype/getHours/name.js | 28 +++++ .../Date/prototype/getHours/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getHours/shell.js | 0 .../prototype/getHours/this-value-invalid-date.js | 13 ++ .../Date/prototype/getHours/this-value-non-date.js | 36 ++++++ .../prototype/getHours/this-value-non-object.js | 46 ++++++++ .../prototype/getHours/this-value-valid-date.js | 46 ++++++++ .../prototype/getMilliseconds/S15.9.5.24_A1_T1.js | 26 ++++ .../prototype/getMilliseconds/S15.9.5.24_A1_T2.js | 23 ++++ .../prototype/getMilliseconds/S15.9.5.24_A1_T3.js | 21 ++++ .../prototype/getMilliseconds/S15.9.5.24_A2_T1.js | 22 ++++ .../prototype/getMilliseconds/S15.9.5.24_A3_T1.js | 25 ++++ .../prototype/getMilliseconds/S15.9.5.24_A3_T2.js | 25 ++++ .../prototype/getMilliseconds/S15.9.5.24_A3_T3.js | 23 ++++ .../Date/prototype/getMilliseconds/browser.js | 0 .../Date/prototype/getMilliseconds/name.js | 28 +++++ .../prototype/getMilliseconds/not-a-constructor.js | 35 ++++++ .../Date/prototype/getMilliseconds/shell.js | 0 .../getMilliseconds/this-value-invalid-date.js | 13 ++ .../getMilliseconds/this-value-non-date.js | 36 ++++++ .../getMilliseconds/this-value-non-object.js | 46 ++++++++ .../getMilliseconds/this-value-valid-date.js | 31 +++++ .../Date/prototype/getMinutes/S15.9.5.20_A1_T1.js | 26 ++++ .../Date/prototype/getMinutes/S15.9.5.20_A1_T2.js | 23 ++++ .../Date/prototype/getMinutes/S15.9.5.20_A1_T3.js | 21 ++++ .../Date/prototype/getMinutes/S15.9.5.20_A2_T1.js | 22 ++++ .../Date/prototype/getMinutes/S15.9.5.20_A3_T1.js | 25 ++++ .../Date/prototype/getMinutes/S15.9.5.20_A3_T2.js | 25 ++++ .../Date/prototype/getMinutes/S15.9.5.20_A3_T3.js | 23 ++++ .../built-ins/Date/prototype/getMinutes/browser.js | 0 .../built-ins/Date/prototype/getMinutes/name.js | 28 +++++ .../Date/prototype/getMinutes/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getMinutes/shell.js | 0 .../getMinutes/this-value-invalid-date.js | 13 ++ .../prototype/getMinutes/this-value-non-date.js | 36 ++++++ .../prototype/getMinutes/this-value-non-object.js | 46 ++++++++ .../prototype/getMinutes/this-value-valid-date.js | 42 +++++++ .../Date/prototype/getMonth/S15.9.5.12_A1_T1.js | 25 ++++ .../Date/prototype/getMonth/S15.9.5.12_A1_T2.js | 18 +++ .../Date/prototype/getMonth/S15.9.5.12_A1_T3.js | 20 ++++ .../Date/prototype/getMonth/S15.9.5.12_A2_T1.js | 17 +++ .../Date/prototype/getMonth/S15.9.5.12_A3_T1.js | 24 ++++ .../Date/prototype/getMonth/S15.9.5.12_A3_T2.js | 24 ++++ .../Date/prototype/getMonth/S15.9.5.12_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/getMonth/browser.js | 0 .../built-ins/Date/prototype/getMonth/name.js | 28 +++++ .../Date/prototype/getMonth/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getMonth/shell.js | 0 .../prototype/getMonth/this-value-invalid-date.js | 13 ++ .../Date/prototype/getMonth/this-value-non-date.js | 36 ++++++ .../prototype/getMonth/this-value-non-object.js | 46 ++++++++ .../prototype/getMonth/this-value-valid-date.js | 42 +++++++ .../Date/prototype/getSeconds/S15.9.5.22_A1_T1.js | 25 ++++ .../Date/prototype/getSeconds/S15.9.5.22_A1_T2.js | 22 ++++ .../Date/prototype/getSeconds/S15.9.5.22_A1_T3.js | 20 ++++ .../Date/prototype/getSeconds/S15.9.5.22_A2_T1.js | 21 ++++ .../Date/prototype/getSeconds/S15.9.5.22_A3_T1.js | 24 ++++ .../Date/prototype/getSeconds/S15.9.5.22_A3_T2.js | 24 ++++ .../Date/prototype/getSeconds/S15.9.5.22_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/getSeconds/browser.js | 0 .../built-ins/Date/prototype/getSeconds/name.js | 28 +++++ .../Date/prototype/getSeconds/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getSeconds/shell.js | 0 .../getSeconds/this-value-invalid-date.js | 13 ++ .../prototype/getSeconds/this-value-non-date.js | 36 ++++++ .../prototype/getSeconds/this-value-non-object.js | 46 ++++++++ .../prototype/getSeconds/this-value-valid-date.js | 50 ++++++++ .../Date/prototype/getTime/S15.9.5.9_A1_T1.js | 25 ++++ .../Date/prototype/getTime/S15.9.5.9_A1_T2.js | 18 +++ .../Date/prototype/getTime/S15.9.5.9_A1_T3.js | 20 ++++ .../Date/prototype/getTime/S15.9.5.9_A2_T1.js | 17 +++ .../Date/prototype/getTime/S15.9.5.9_A3_T1.js | 24 ++++ .../Date/prototype/getTime/S15.9.5.9_A3_T2.js | 24 ++++ .../Date/prototype/getTime/S15.9.5.9_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/getTime/browser.js | 0 .../built-ins/Date/prototype/getTime/name.js | 28 +++++ .../Date/prototype/getTime/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getTime/shell.js | 0 .../prototype/getTime/this-value-invalid-date.js | 12 ++ .../Date/prototype/getTime/this-value-non-date.js | 36 ++++++ .../prototype/getTime/this-value-non-object.js | 46 ++++++++ .../prototype/getTime/this-value-valid-date.js | 17 +++ .../getTimezoneOffset/S15.9.5.26_A1_T1.js | 27 +++++ .../getTimezoneOffset/S15.9.5.26_A1_T2.js | 24 ++++ .../getTimezoneOffset/S15.9.5.26_A1_T3.js | 22 ++++ .../getTimezoneOffset/S15.9.5.26_A2_T1.js | 21 ++++ .../getTimezoneOffset/S15.9.5.26_A3_T1.js | 24 ++++ .../getTimezoneOffset/S15.9.5.26_A3_T2.js | 24 ++++ .../getTimezoneOffset/S15.9.5.26_A3_T3.js | 22 ++++ .../Date/prototype/getTimezoneOffset/browser.js | 0 .../Date/prototype/getTimezoneOffset/name.js | 28 +++++ .../getTimezoneOffset/not-a-constructor.js | 35 ++++++ .../Date/prototype/getTimezoneOffset/shell.js | 0 .../getTimezoneOffset/this-value-invalid-date.js | 13 ++ .../getTimezoneOffset/this-value-non-date.js | 36 ++++++ .../getTimezoneOffset/this-value-non-object.js | 46 ++++++++ .../getTimezoneOffset/this-value-valid-date.js | 32 +++++ .../Date/prototype/getUTCDate/S15.9.5.15_A1_T1.js | 25 ++++ .../Date/prototype/getUTCDate/S15.9.5.15_A1_T2.js | 22 ++++ .../Date/prototype/getUTCDate/S15.9.5.15_A1_T3.js | 20 ++++ .../Date/prototype/getUTCDate/S15.9.5.15_A2_T1.js | 21 ++++ .../Date/prototype/getUTCDate/S15.9.5.15_A3_T1.js | 24 ++++ .../Date/prototype/getUTCDate/S15.9.5.15_A3_T2.js | 24 ++++ .../Date/prototype/getUTCDate/S15.9.5.15_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/getUTCDate/browser.js | 0 .../built-ins/Date/prototype/getUTCDate/name.js | 28 +++++ .../Date/prototype/getUTCDate/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getUTCDate/shell.js | 0 .../getUTCDate/this-value-invalid-date.js | 13 ++ .../prototype/getUTCDate/this-value-non-date.js | 36 ++++++ .../prototype/getUTCDate/this-value-non-object.js | 46 ++++++++ .../prototype/getUTCDate/this-value-valid-date.js | 44 +++++++ .../Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js | 25 ++++ .../Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js | 18 +++ .../Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js | 20 ++++ .../Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js | 21 ++++ .../Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js | 24 ++++ .../Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js | 24 ++++ .../Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/getUTCDay/browser.js | 0 .../built-ins/Date/prototype/getUTCDay/name.js | 28 +++++ .../Date/prototype/getUTCDay/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getUTCDay/shell.js | 0 .../prototype/getUTCDay/this-value-invalid-date.js | 13 ++ .../prototype/getUTCDay/this-value-non-date.js | 36 ++++++ .../prototype/getUTCDay/this-value-non-object.js | 46 ++++++++ .../prototype/getUTCDay/this-value-valid-date.js | 44 +++++++ .../prototype/getUTCFullYear/S15.9.5.11_A1_T1.js | 25 ++++ .../prototype/getUTCFullYear/S15.9.5.11_A1_T2.js | 22 ++++ .../prototype/getUTCFullYear/S15.9.5.11_A1_T3.js | 20 ++++ .../prototype/getUTCFullYear/S15.9.5.11_A2_T1.js | 21 ++++ .../prototype/getUTCFullYear/S15.9.5.11_A3_T1.js | 24 ++++ .../prototype/getUTCFullYear/S15.9.5.11_A3_T2.js | 24 ++++ .../prototype/getUTCFullYear/S15.9.5.11_A3_T3.js | 22 ++++ .../Date/prototype/getUTCFullYear/browser.js | 0 .../Date/prototype/getUTCFullYear/name.js | 28 +++++ .../prototype/getUTCFullYear/not-a-constructor.js | 35 ++++++ .../Date/prototype/getUTCFullYear/shell.js | 0 .../getUTCFullYear/this-value-invalid-date.js | 13 ++ .../getUTCFullYear/this-value-non-date.js | 36 ++++++ .../getUTCFullYear/this-value-non-object.js | 46 ++++++++ .../getUTCFullYear/this-value-valid-date.js | 26 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js | 25 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js | 22 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js | 20 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js | 21 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js | 24 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js | 24 ++++ .../Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js | 22 ++++ .../Date/prototype/getUTCHours/browser.js | 0 .../built-ins/Date/prototype/getUTCHours/name.js | 28 +++++ .../prototype/getUTCHours/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getUTCHours/shell.js | 0 .../getUTCHours/this-value-invalid-date.js | 13 ++ .../prototype/getUTCHours/this-value-non-date.js | 36 ++++++ .../prototype/getUTCHours/this-value-non-object.js | 46 ++++++++ .../prototype/getUTCHours/this-value-valid-date.js | 44 +++++++ .../getUTCMilliseconds/S15.9.5.25_A1_T1.js | 27 +++++ .../getUTCMilliseconds/S15.9.5.25_A1_T2.js | 24 ++++ .../getUTCMilliseconds/S15.9.5.25_A1_T3.js | 22 ++++ .../getUTCMilliseconds/S15.9.5.25_A2_T1.js | 21 ++++ .../getUTCMilliseconds/S15.9.5.25_A3_T1.js | 24 ++++ .../getUTCMilliseconds/S15.9.5.25_A3_T2.js | 24 ++++ .../getUTCMilliseconds/S15.9.5.25_A3_T3.js | 22 ++++ .../Date/prototype/getUTCMilliseconds/browser.js | 0 .../Date/prototype/getUTCMilliseconds/name.js | 28 +++++ .../getUTCMilliseconds/not-a-constructor.js | 35 ++++++ .../Date/prototype/getUTCMilliseconds/shell.js | 0 .../getUTCMilliseconds/this-value-invalid-date.js | 13 ++ .../getUTCMilliseconds/this-value-non-date.js | 36 ++++++ .../getUTCMilliseconds/this-value-non-object.js | 46 ++++++++ .../getUTCMilliseconds/this-value-valid-date.js | 25 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A1_T1.js | 25 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A1_T2.js | 22 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A1_T3.js | 20 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A2_T1.js | 21 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A3_T1.js | 24 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A3_T2.js | 24 ++++ .../prototype/getUTCMinutes/S15.9.5.21_A3_T3.js | 22 ++++ .../Date/prototype/getUTCMinutes/browser.js | 0 .../built-ins/Date/prototype/getUTCMinutes/name.js | 28 +++++ .../prototype/getUTCMinutes/not-a-constructor.js | 35 ++++++ .../Date/prototype/getUTCMinutes/shell.js | 0 .../getUTCMinutes/this-value-invalid-date.js | 13 ++ .../prototype/getUTCMinutes/this-value-non-date.js | 36 ++++++ .../getUTCMinutes/this-value-non-object.js | 46 ++++++++ .../getUTCMinutes/this-value-valid-date.js | 52 ++++++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A1_T1.js | 25 ++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A1_T2.js | 22 ++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A1_T3.js | 20 ++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A2_T1.js | 21 ++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A3_T1.js | 24 ++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A3_T2.js | 24 ++++ .../Date/prototype/getUTCMonth/S15.9.5.13_A3_T3.js | 22 ++++ .../Date/prototype/getUTCMonth/browser.js | 0 .../built-ins/Date/prototype/getUTCMonth/name.js | 28 +++++ .../prototype/getUTCMonth/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/getUTCMonth/shell.js | 0 .../getUTCMonth/this-value-invalid-date.js | 13 ++ .../prototype/getUTCMonth/this-value-non-date.js | 36 ++++++ .../prototype/getUTCMonth/this-value-non-object.js | 46 ++++++++ .../prototype/getUTCMonth/this-value-valid-date.js | 44 +++++++ .../prototype/getUTCSeconds/S15.9.5.23_A1_T1.js | 25 ++++ .../prototype/getUTCSeconds/S15.9.5.23_A1_T2.js | 22 ++++ .../prototype/getUTCSeconds/S15.9.5.23_A1_T3.js | 20 ++++ .../prototype/getUTCSeconds/S15.9.5.23_A2_T1.js | 21 ++++ .../prototype/getUTCSeconds/S15.9.5.23_A3_T1.js | 24 ++++ .../prototype/getUTCSeconds/S15.9.5.23_A3_T2.js | 24 ++++ .../prototype/getUTCSeconds/S15.9.5.23_A3_T3.js | 22 ++++ .../Date/prototype/getUTCSeconds/browser.js | 0 .../built-ins/Date/prototype/getUTCSeconds/name.js | 28 +++++ .../prototype/getUTCSeconds/not-a-constructor.js | 35 ++++++ .../Date/prototype/getUTCSeconds/shell.js | 0 .../getUTCSeconds/this-value-invalid-date.js | 13 ++ .../prototype/getUTCSeconds/this-value-non-date.js | 36 ++++++ .../getUTCSeconds/this-value-non-object.js | 46 ++++++++ .../getUTCSeconds/this-value-valid-date.js | 45 +++++++ .../built-ins/Date/prototype/no-date-value.js | 29 +++++ .../Date/prototype/setDate/S15.9.5.36_A1_T1.js | 25 ++++ .../Date/prototype/setDate/S15.9.5.36_A1_T2.js | 18 +++ .../Date/prototype/setDate/S15.9.5.36_A1_T3.js | 20 ++++ .../Date/prototype/setDate/S15.9.5.36_A2_T1.js | 17 +++ .../Date/prototype/setDate/S15.9.5.36_A3_T1.js | 24 ++++ .../Date/prototype/setDate/S15.9.5.36_A3_T2.js | 24 ++++ .../Date/prototype/setDate/S15.9.5.36_A3_T3.js | 22 ++++ .../Date/prototype/setDate/arg-coercion-order.js | 32 +++++ .../Date/prototype/setDate/arg-to-number-err.js | 25 ++++ .../Date/prototype/setDate/arg-to-number.js | 57 +++++++++ .../built-ins/Date/prototype/setDate/browser.js | 0 .../built-ins/Date/prototype/setDate/name.js | 28 +++++ .../Date/prototype/setDate/new-value-time-clip.js | 30 +++++ .../Date/prototype/setDate/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setDate/shell.js | 0 .../prototype/setDate/this-value-invalid-date.js | 25 ++++ .../Date/prototype/setDate/this-value-non-date.js | 45 +++++++ .../prototype/setDate/this-value-non-object.js | 55 +++++++++ .../prototype/setDate/this-value-valid-date.js | 49 ++++++++ .../Date/prototype/setFullYear/15.9.5.40_1.js | 16 +++ .../Date/prototype/setFullYear/S15.9.5.40_A1_T1.js | 25 ++++ .../Date/prototype/setFullYear/S15.9.5.40_A1_T2.js | 22 ++++ .../Date/prototype/setFullYear/S15.9.5.40_A1_T3.js | 20 ++++ .../Date/prototype/setFullYear/S15.9.5.40_A2_T1.js | 21 ++++ .../Date/prototype/setFullYear/S15.9.5.40_A3_T1.js | 24 ++++ .../Date/prototype/setFullYear/S15.9.5.40_A3_T2.js | 24 ++++ .../Date/prototype/setFullYear/S15.9.5.40_A3_T3.js | 22 ++++ .../setFullYear/arg-date-to-number-err.js | 30 +++++ .../prototype/setFullYear/arg-date-to-number.js | 79 +++++++++++++ .../setFullYear/arg-month-to-number-err.js | 35 ++++++ .../prototype/setFullYear/arg-month-to-number.js | 79 +++++++++++++ .../setFullYear/arg-year-to-number-err.js | 33 ++++++ .../prototype/setFullYear/arg-year-to-number.js | 79 +++++++++++++ .../Date/prototype/setFullYear/browser.js | 0 .../built-ins/Date/prototype/setFullYear/name.js | 28 +++++ .../prototype/setFullYear/new-value-time-clip.js | 50 ++++++++ .../prototype/setFullYear/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setFullYear/shell.js | 0 .../setFullYear/this-value-invalid-date.js | 52 ++++++++ .../prototype/setFullYear/this-value-non-date.js | 45 +++++++ .../prototype/setFullYear/this-value-non-object.js | 55 +++++++++ .../setFullYear/this-value-valid-date-date.js | 57 +++++++++ .../setFullYear/this-value-valid-date-month.js | 57 +++++++++ .../setFullYear/this-value-valid-date-year.js | 29 +++++ .../Date/prototype/setHours/S15.9.5.34_A1_T1.js | 25 ++++ .../Date/prototype/setHours/S15.9.5.34_A1_T2.js | 18 +++ .../Date/prototype/setHours/S15.9.5.34_A1_T3.js | 20 ++++ .../Date/prototype/setHours/S15.9.5.34_A2_T1.js | 17 +++ .../Date/prototype/setHours/S15.9.5.34_A3_T1.js | 24 ++++ .../Date/prototype/setHours/S15.9.5.34_A3_T2.js | 24 ++++ .../Date/prototype/setHours/S15.9.5.34_A3_T3.js | 22 ++++ .../Date/prototype/setHours/arg-coercion-order.js | 59 ++++++++++ .../prototype/setHours/arg-hour-to-number-err.js | 32 +++++ .../Date/prototype/setHours/arg-hour-to-number.js | 64 ++++++++++ .../prototype/setHours/arg-min-to-number-err.js | 34 ++++++ .../Date/prototype/setHours/arg-min-to-number.js | 64 ++++++++++ .../prototype/setHours/arg-ms-to-number-err.js | 31 +++++ .../Date/prototype/setHours/arg-ms-to-number.js | 68 +++++++++++ .../prototype/setHours/arg-sec-to-number-err.js | 36 ++++++ .../Date/prototype/setHours/arg-sec-to-number.js | 66 +++++++++++ .../built-ins/Date/prototype/setHours/browser.js | 0 .../built-ins/Date/prototype/setHours/name.js | 28 +++++ .../Date/prototype/setHours/new-value-time-clip.js | 54 +++++++++ .../Date/prototype/setHours/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setHours/shell.js | 0 .../prototype/setHours/this-value-invalid-date.js | 45 +++++++ .../Date/prototype/setHours/this-value-non-date.js | 45 +++++++ .../prototype/setHours/this-value-non-object.js | 55 +++++++++ .../setHours/this-value-valid-date-hour.js | 58 +++++++++ .../setHours/this-value-valid-date-min.js | 58 +++++++++ .../prototype/setHours/this-value-valid-date-ms.js | 60 ++++++++++ .../setHours/this-value-valid-date-sec.js | 58 +++++++++ .../prototype/setMilliseconds/S15.9.5.28_A1_T1.js | 25 ++++ .../prototype/setMilliseconds/S15.9.5.28_A1_T2.js | 22 ++++ .../prototype/setMilliseconds/S15.9.5.28_A1_T3.js | 20 ++++ .../prototype/setMilliseconds/S15.9.5.28_A2_T1.js | 21 ++++ .../prototype/setMilliseconds/S15.9.5.28_A3_T1.js | 24 ++++ .../prototype/setMilliseconds/S15.9.5.28_A3_T2.js | 24 ++++ .../prototype/setMilliseconds/S15.9.5.28_A3_T3.js | 22 ++++ .../setMilliseconds/arg-coercion-order.js | 32 +++++ .../prototype/setMilliseconds/arg-to-number-err.js | 25 ++++ .../prototype/setMilliseconds/arg-to-number.js | 63 ++++++++++ .../Date/prototype/setMilliseconds/browser.js | 0 .../Date/prototype/setMilliseconds/name.js | 28 +++++ .../setMilliseconds/new-value-time-clip.js | 30 +++++ .../prototype/setMilliseconds/not-a-constructor.js | 35 ++++++ .../Date/prototype/setMilliseconds/shell.js | 0 .../setMilliseconds/this-value-invalid-date.js | 25 ++++ .../setMilliseconds/this-value-non-date.js | 45 +++++++ .../setMilliseconds/this-value-non-object.js | 55 +++++++++ .../setMilliseconds/this-value-valid-date.js | 49 ++++++++ .../Date/prototype/setMinutes/S15.9.5.32_A1_T1.js | 25 ++++ .../Date/prototype/setMinutes/S15.9.5.32_A1_T2.js | 22 ++++ .../Date/prototype/setMinutes/S15.9.5.32_A1_T3.js | 20 ++++ .../Date/prototype/setMinutes/S15.9.5.32_A2_T1.js | 21 ++++ .../Date/prototype/setMinutes/S15.9.5.32_A3_T1.js | 24 ++++ .../Date/prototype/setMinutes/S15.9.5.32_A3_T2.js | 24 ++++ .../Date/prototype/setMinutes/S15.9.5.32_A3_T3.js | 22 ++++ .../prototype/setMinutes/arg-coercion-order.js | 51 ++++++++ .../prototype/setMinutes/arg-min-to-number-err.js | 32 +++++ .../Date/prototype/setMinutes/arg-min-to-number.js | 62 ++++++++++ .../prototype/setMinutes/arg-ms-to-number-err.js | 29 +++++ .../Date/prototype/setMinutes/arg-ms-to-number.js | 66 +++++++++++ .../prototype/setMinutes/arg-sec-to-number-err.js | 34 ++++++ .../Date/prototype/setMinutes/arg-sec-to-number.js | 64 ++++++++++ .../built-ins/Date/prototype/setMinutes/browser.js | 0 .../built-ins/Date/prototype/setMinutes/name.js | 28 +++++ .../prototype/setMinutes/new-value-time-clip.js | 46 ++++++++ .../Date/prototype/setMinutes/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setMinutes/shell.js | 0 .../setMinutes/this-value-invalid-date.js | 45 +++++++ .../prototype/setMinutes/this-value-non-date.js | 45 +++++++ .../prototype/setMinutes/this-value-non-object.js | 55 +++++++++ .../prototype/setMinutes/this-value-valid-date.js | 131 +++++++++++++++++++++ .../Date/prototype/setMonth/S15.9.5.38_A1_T1.js | 25 ++++ .../Date/prototype/setMonth/S15.9.5.38_A1_T2.js | 18 +++ .../Date/prototype/setMonth/S15.9.5.38_A1_T3.js | 20 ++++ .../Date/prototype/setMonth/S15.9.5.38_A2_T1.js | 17 +++ .../Date/prototype/setMonth/S15.9.5.38_A3_T1.js | 24 ++++ .../Date/prototype/setMonth/S15.9.5.38_A3_T2.js | 24 ++++ .../Date/prototype/setMonth/S15.9.5.38_A3_T3.js | 22 ++++ .../Date/prototype/setMonth/arg-coercion-order.js | 43 +++++++ .../prototype/setMonth/arg-date-to-number-err.js | 27 +++++ .../Date/prototype/setMonth/arg-date-to-number.js | 77 ++++++++++++ .../prototype/setMonth/arg-month-to-number-err.js | 35 ++++++ .../Date/prototype/setMonth/arg-month-to-number.js | 79 +++++++++++++ .../built-ins/Date/prototype/setMonth/browser.js | 0 .../built-ins/Date/prototype/setMonth/name.js | 28 +++++ .../Date/prototype/setMonth/new-value-time-clip.js | 43 +++++++ .../Date/prototype/setMonth/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setMonth/shell.js | 0 .../prototype/setMonth/this-value-invalid-date.js | 34 ++++++ .../Date/prototype/setMonth/this-value-non-date.js | 45 +++++++ .../prototype/setMonth/this-value-non-object.js | 55 +++++++++ .../setMonth/this-value-valid-date-date.js | 55 +++++++++ .../setMonth/this-value-valid-date-month.js | 55 +++++++++ .../Date/prototype/setSeconds/S15.9.5.30_A1_T1.js | 25 ++++ .../Date/prototype/setSeconds/S15.9.5.30_A1_T2.js | 22 ++++ .../Date/prototype/setSeconds/S15.9.5.30_A1_T3.js | 20 ++++ .../Date/prototype/setSeconds/S15.9.5.30_A2_T1.js | 21 ++++ .../Date/prototype/setSeconds/S15.9.5.30_A3_T1.js | 24 ++++ .../Date/prototype/setSeconds/S15.9.5.30_A3_T2.js | 24 ++++ .../Date/prototype/setSeconds/S15.9.5.30_A3_T3.js | 22 ++++ .../prototype/setSeconds/arg-coercion-order.js | 43 +++++++ .../prototype/setSeconds/arg-ms-to-number-err.js | 27 +++++ .../Date/prototype/setSeconds/arg-ms-to-number.js | 65 ++++++++++ .../prototype/setSeconds/arg-sec-to-number-err.js | 32 +++++ .../Date/prototype/setSeconds/arg-sec-to-number.js | 63 ++++++++++ .../built-ins/Date/prototype/setSeconds/browser.js | 0 .../built-ins/Date/prototype/setSeconds/name.js | 28 +++++ .../prototype/setSeconds/new-value-time-clip.js | 39 ++++++ .../Date/prototype/setSeconds/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setSeconds/shell.js | 0 .../setSeconds/this-value-invalid-date.js | 32 +++++ .../prototype/setSeconds/this-value-non-date.js | 45 +++++++ .../prototype/setSeconds/this-value-non-object.js | 55 +++++++++ .../setSeconds/this-value-valid-date-ms.js | 57 +++++++++ .../setSeconds/this-value-valid-date-sec.js | 55 +++++++++ .../Date/prototype/setTime/S15.9.5.27_A1_T1.js | 25 ++++ .../Date/prototype/setTime/S15.9.5.27_A1_T2.js | 18 +++ .../Date/prototype/setTime/S15.9.5.27_A1_T3.js | 20 ++++ .../Date/prototype/setTime/S15.9.5.27_A2_T1.js | 17 +++ .../Date/prototype/setTime/S15.9.5.27_A3_T1.js | 24 ++++ .../Date/prototype/setTime/S15.9.5.27_A3_T2.js | 24 ++++ .../Date/prototype/setTime/S15.9.5.27_A3_T3.js | 22 ++++ .../Date/prototype/setTime/arg-to-number-err.js | 25 ++++ .../Date/prototype/setTime/arg-to-number.js | 53 +++++++++ .../built-ins/Date/prototype/setTime/browser.js | 0 .../built-ins/Date/prototype/setTime/name.js | 28 +++++ .../Date/prototype/setTime/new-value-time-clip.js | 29 +++++ .../Date/prototype/setTime/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setTime/shell.js | 0 .../prototype/setTime/this-value-invalid-date.js | 23 ++++ .../Date/prototype/setTime/this-value-non-date.js | 45 +++++++ .../prototype/setTime/this-value-non-object.js | 55 +++++++++ .../prototype/setTime/this-value-valid-date.js | 28 +++++ .../Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js | 25 ++++ .../Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js | 22 ++++ .../Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js | 20 ++++ .../Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js | 21 ++++ .../Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js | 24 ++++ .../Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js | 24 ++++ .../Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js | 22 ++++ .../prototype/setUTCDate/arg-coercion-order.js | 31 +++++ .../built-ins/Date/prototype/setUTCDate/browser.js | 0 .../built-ins/Date/prototype/setUTCDate/name.js | 28 +++++ .../Date/prototype/setUTCDate/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setUTCDate/shell.js | 0 .../prototype/setUTCFullYear/S15.9.5.41_A1_T1.js | 25 ++++ .../prototype/setUTCFullYear/S15.9.5.41_A1_T2.js | 22 ++++ .../prototype/setUTCFullYear/S15.9.5.41_A1_T3.js | 20 ++++ .../prototype/setUTCFullYear/S15.9.5.41_A2_T1.js | 21 ++++ .../prototype/setUTCFullYear/S15.9.5.41_A3_T1.js | 24 ++++ .../prototype/setUTCFullYear/S15.9.5.41_A3_T2.js | 24 ++++ .../prototype/setUTCFullYear/S15.9.5.41_A3_T3.js | 22 ++++ .../Date/prototype/setUTCFullYear/browser.js | 0 .../Date/prototype/setUTCFullYear/name.js | 28 +++++ .../prototype/setUTCFullYear/not-a-constructor.js | 35 ++++++ .../Date/prototype/setUTCFullYear/shell.js | 0 .../Date/prototype/setUTCHours/S15.9.5.35_A1_T1.js | 25 ++++ .../Date/prototype/setUTCHours/S15.9.5.35_A1_T2.js | 22 ++++ .../Date/prototype/setUTCHours/S15.9.5.35_A1_T3.js | 20 ++++ .../Date/prototype/setUTCHours/S15.9.5.35_A2_T1.js | 21 ++++ .../Date/prototype/setUTCHours/S15.9.5.35_A3_T1.js | 24 ++++ .../Date/prototype/setUTCHours/S15.9.5.35_A3_T2.js | 24 ++++ .../Date/prototype/setUTCHours/S15.9.5.35_A3_T3.js | 22 ++++ .../prototype/setUTCHours/arg-coercion-order.js | 58 +++++++++ .../Date/prototype/setUTCHours/browser.js | 0 .../built-ins/Date/prototype/setUTCHours/name.js | 28 +++++ .../prototype/setUTCHours/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setUTCHours/shell.js | 0 .../setUTCMilliseconds/S15.9.5.29_A1_T1.js | 27 +++++ .../setUTCMilliseconds/S15.9.5.29_A1_T2.js | 24 ++++ .../setUTCMilliseconds/S15.9.5.29_A1_T3.js | 22 ++++ .../setUTCMilliseconds/S15.9.5.29_A2_T1.js | 21 ++++ .../setUTCMilliseconds/S15.9.5.29_A3_T1.js | 24 ++++ .../setUTCMilliseconds/S15.9.5.29_A3_T2.js | 24 ++++ .../setUTCMilliseconds/S15.9.5.29_A3_T3.js | 22 ++++ .../setUTCMilliseconds/arg-coercion-order.js | 32 +++++ .../Date/prototype/setUTCMilliseconds/browser.js | 0 .../Date/prototype/setUTCMilliseconds/name.js | 28 +++++ .../setUTCMilliseconds/not-a-constructor.js | 35 ++++++ .../Date/prototype/setUTCMilliseconds/shell.js | 0 .../prototype/setUTCMinutes/S15.9.5.33_A1_T1.js | 25 ++++ .../prototype/setUTCMinutes/S15.9.5.33_A1_T2.js | 22 ++++ .../prototype/setUTCMinutes/S15.9.5.33_A1_T3.js | 20 ++++ .../prototype/setUTCMinutes/S15.9.5.33_A2_T1.js | 21 ++++ .../prototype/setUTCMinutes/S15.9.5.33_A3_T1.js | 24 ++++ .../prototype/setUTCMinutes/S15.9.5.33_A3_T2.js | 24 ++++ .../prototype/setUTCMinutes/S15.9.5.33_A3_T3.js | 22 ++++ .../prototype/setUTCMinutes/arg-coercion-order.js | 50 ++++++++ .../Date/prototype/setUTCMinutes/browser.js | 0 .../built-ins/Date/prototype/setUTCMinutes/name.js | 28 +++++ .../prototype/setUTCMinutes/not-a-constructor.js | 35 ++++++ .../Date/prototype/setUTCMinutes/shell.js | 0 .../Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js | 25 ++++ .../Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js | 22 ++++ .../Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js | 20 ++++ .../Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js | 21 ++++ .../Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js | 24 ++++ .../Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js | 24 ++++ .../Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js | 22 ++++ .../prototype/setUTCMonth/arg-coercion-order.js | 42 +++++++ .../Date/prototype/setUTCMonth/browser.js | 0 .../built-ins/Date/prototype/setUTCMonth/name.js | 28 +++++ .../prototype/setUTCMonth/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/setUTCMonth/shell.js | 0 .../prototype/setUTCSeconds/S15.9.5.31_A1_T1.js | 25 ++++ .../prototype/setUTCSeconds/S15.9.5.31_A1_T2.js | 22 ++++ .../prototype/setUTCSeconds/S15.9.5.31_A1_T3.js | 20 ++++ .../prototype/setUTCSeconds/S15.9.5.31_A2_T1.js | 21 ++++ .../prototype/setUTCSeconds/S15.9.5.31_A3_T1.js | 24 ++++ .../prototype/setUTCSeconds/S15.9.5.31_A3_T2.js | 24 ++++ .../prototype/setUTCSeconds/S15.9.5.31_A3_T3.js | 22 ++++ .../prototype/setUTCSeconds/arg-coercion-order.js | 42 +++++++ .../Date/prototype/setUTCSeconds/browser.js | 0 .../built-ins/Date/prototype/setUTCSeconds/name.js | 28 +++++ .../prototype/setUTCSeconds/not-a-constructor.js | 35 ++++++ .../Date/prototype/setUTCSeconds/shell.js | 0 .../test262/built-ins/Date/prototype/shell.js | 0 .../Date/prototype/toDateString/S15.9.5.3_A1_T1.js | 25 ++++ .../Date/prototype/toDateString/S15.9.5.3_A1_T2.js | 22 ++++ .../Date/prototype/toDateString/S15.9.5.3_A1_T3.js | 20 ++++ .../Date/prototype/toDateString/S15.9.5.3_A2_T1.js | 21 ++++ .../Date/prototype/toDateString/S15.9.5.3_A3_T1.js | 24 ++++ .../Date/prototype/toDateString/S15.9.5.3_A3_T2.js | 24 ++++ .../Date/prototype/toDateString/S15.9.5.3_A3_T3.js | 22 ++++ .../Date/prototype/toDateString/browser.js | 0 .../Date/prototype/toDateString/format.js | 21 ++++ .../Date/prototype/toDateString/invalid-date.js | 17 +++ .../built-ins/Date/prototype/toDateString/name.js | 28 +++++ .../Date/prototype/toDateString/negative-year.js | 35 ++++++ .../prototype/toDateString/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/toDateString/shell.js | 0 .../Date/prototype/toISOString/15.9.5.43-0-10.js | 29 +++++ .../Date/prototype/toISOString/15.9.5.43-0-11.js | 20 ++++ .../Date/prototype/toISOString/15.9.5.43-0-12.js | 20 ++++ .../Date/prototype/toISOString/15.9.5.43-0-13.js | 17 +++ .../Date/prototype/toISOString/15.9.5.43-0-14.js | 16 +++ .../Date/prototype/toISOString/15.9.5.43-0-15.js | 16 +++ .../Date/prototype/toISOString/15.9.5.43-0-16.js | 17 +++ .../Date/prototype/toISOString/15.9.5.43-0-2.js | 13 ++ .../Date/prototype/toISOString/15.9.5.43-0-3.js | 11 ++ .../Date/prototype/toISOString/15.9.5.43-0-4.js | 16 +++ .../Date/prototype/toISOString/15.9.5.43-0-5.js | 15 +++ .../Date/prototype/toISOString/15.9.5.43-0-6.js | 16 +++ .../Date/prototype/toISOString/15.9.5.43-0-7.js | 16 +++ .../Date/prototype/toISOString/15.9.5.43-0-8.js | 24 ++++ .../Date/prototype/toISOString/15.9.5.43-0-9.js | 29 +++++ .../Date/prototype/toISOString/browser.js | 0 .../built-ins/Date/prototype/toISOString/name.js | 28 +++++ .../prototype/toISOString/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/toISOString/shell.js | 0 .../built-ins/Date/prototype/toJSON/browser.js | 0 .../built-ins/Date/prototype/toJSON/builtin.js | 26 ++++ .../Date/prototype/toJSON/called-as-function.js | 34 ++++++ .../Date/prototype/toJSON/invoke-abrupt.js | 40 +++++++ .../Date/prototype/toJSON/invoke-arguments.js | 44 +++++++ .../Date/prototype/toJSON/invoke-result.js | 31 +++++ .../built-ins/Date/prototype/toJSON/length.js | 25 ++++ .../built-ins/Date/prototype/toJSON/name.js | 29 +++++ .../built-ins/Date/prototype/toJSON/non-finite.js | 29 +++++ .../Date/prototype/toJSON/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/toJSON/shell.js | 0 .../built-ins/Date/prototype/toJSON/to-object.js | 31 +++++ .../Date/prototype/toJSON/to-primitive-abrupt.js | 58 +++++++++ .../Date/prototype/toJSON/to-primitive-symbol.js | 47 ++++++++ .../Date/prototype/toJSON/to-primitive-value-of.js | 48 ++++++++ .../toLocaleDateString/S15.9.5.6_A1_T1.js | 27 +++++ .../toLocaleDateString/S15.9.5.6_A1_T2.js | 24 ++++ .../toLocaleDateString/S15.9.5.6_A1_T3.js | 22 ++++ .../toLocaleDateString/S15.9.5.6_A2_T1.js | 21 ++++ .../toLocaleDateString/S15.9.5.6_A3_T1.js | 24 ++++ .../toLocaleDateString/S15.9.5.6_A3_T2.js | 24 ++++ .../toLocaleDateString/S15.9.5.6_A3_T3.js | 22 ++++ .../Date/prototype/toLocaleDateString/browser.js | 0 .../Date/prototype/toLocaleDateString/name.js | 28 +++++ .../toLocaleDateString/not-a-constructor.js | 35 ++++++ .../Date/prototype/toLocaleDateString/shell.js | 0 .../prototype/toLocaleString/S15.9.5.5_A1_T1.js | 25 ++++ .../prototype/toLocaleString/S15.9.5.5_A1_T2.js | 23 ++++ .../prototype/toLocaleString/S15.9.5.5_A1_T3.js | 20 ++++ .../prototype/toLocaleString/S15.9.5.5_A2_T1.js | 22 ++++ .../prototype/toLocaleString/S15.9.5.5_A3_T1.js | 24 ++++ .../prototype/toLocaleString/S15.9.5.5_A3_T2.js | 25 ++++ .../prototype/toLocaleString/S15.9.5.5_A3_T3.js | 22 ++++ .../Date/prototype/toLocaleString/browser.js | 0 .../Date/prototype/toLocaleString/name.js | 28 +++++ .../prototype/toLocaleString/not-a-constructor.js | 35 ++++++ .../Date/prototype/toLocaleString/shell.js | 0 .../toLocaleTimeString/S15.9.5.7_A1_T1.js | 27 +++++ .../toLocaleTimeString/S15.9.5.7_A1_T2.js | 25 ++++ .../toLocaleTimeString/S15.9.5.7_A1_T3.js | 22 ++++ .../toLocaleTimeString/S15.9.5.7_A2_T1.js | 22 ++++ .../toLocaleTimeString/S15.9.5.7_A3_T1.js | 24 ++++ .../toLocaleTimeString/S15.9.5.7_A3_T2.js | 25 ++++ .../toLocaleTimeString/S15.9.5.7_A3_T3.js | 22 ++++ .../Date/prototype/toLocaleTimeString/browser.js | 0 .../Date/prototype/toLocaleTimeString/name.js | 28 +++++ .../toLocaleTimeString/not-a-constructor.js | 35 ++++++ .../Date/prototype/toLocaleTimeString/shell.js | 0 .../Date/prototype/toString/S15.9.5.2_A1_T1.js | 25 ++++ .../Date/prototype/toString/S15.9.5.2_A1_T2.js | 18 +++ .../Date/prototype/toString/S15.9.5.2_A1_T3.js | 20 ++++ .../Date/prototype/toString/S15.9.5.2_A2_T1.js | 18 +++ .../Date/prototype/toString/S15.9.5.2_A3_T1.js | 24 ++++ .../Date/prototype/toString/S15.9.5.2_A3_T2.js | 25 ++++ .../Date/prototype/toString/S15.9.5.2_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/toString/browser.js | 0 .../built-ins/Date/prototype/toString/format.js | 22 ++++ .../Date/prototype/toString/invalid-date.js | 17 +++ .../built-ins/Date/prototype/toString/name.js | 28 +++++ .../Date/prototype/toString/negative-year.js | 36 ++++++ .../Date/prototype/toString/non-date-receiver.js | 22 ++++ .../Date/prototype/toString/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/toString/shell.js | 0 .../Date/prototype/toTimeString/S15.9.5.4_A1_T1.js | 25 ++++ .../Date/prototype/toTimeString/S15.9.5.4_A1_T2.js | 23 ++++ .../Date/prototype/toTimeString/S15.9.5.4_A1_T3.js | 20 ++++ .../Date/prototype/toTimeString/S15.9.5.4_A2_T1.js | 22 ++++ .../Date/prototype/toTimeString/S15.9.5.4_A3_T1.js | 24 ++++ .../Date/prototype/toTimeString/S15.9.5.4_A3_T2.js | 24 ++++ .../Date/prototype/toTimeString/S15.9.5.4_A3_T3.js | 22 ++++ .../Date/prototype/toTimeString/browser.js | 0 .../Date/prototype/toTimeString/format.js | 17 +++ .../Date/prototype/toTimeString/invalid-date.js | 17 +++ .../built-ins/Date/prototype/toTimeString/name.js | 28 +++++ .../prototype/toTimeString/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/toTimeString/shell.js | 0 .../Date/prototype/toUTCString/S15.9.5.42_A1_T1.js | 25 ++++ .../Date/prototype/toUTCString/S15.9.5.42_A1_T2.js | 23 ++++ .../Date/prototype/toUTCString/S15.9.5.42_A1_T3.js | 20 ++++ .../Date/prototype/toUTCString/S15.9.5.42_A2_T1.js | 22 ++++ .../Date/prototype/toUTCString/S15.9.5.42_A3_T1.js | 24 ++++ .../Date/prototype/toUTCString/S15.9.5.42_A3_T2.js | 25 ++++ .../Date/prototype/toUTCString/S15.9.5.42_A3_T3.js | 22 ++++ .../Date/prototype/toUTCString/browser.js | 0 .../Date/prototype/toUTCString/day-names.js | 24 ++++ .../built-ins/Date/prototype/toUTCString/format.js | 20 ++++ .../Date/prototype/toUTCString/invalid-date.js | 17 +++ .../Date/prototype/toUTCString/month-names.js | 34 ++++++ .../built-ins/Date/prototype/toUTCString/name.js | 28 +++++ .../Date/prototype/toUTCString/negative-year.js | 35 ++++++ .../prototype/toUTCString/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/toUTCString/shell.js | 0 .../Date/prototype/valueOf/S15.9.5.8_A1_T1.js | 25 ++++ .../Date/prototype/valueOf/S15.9.5.8_A1_T2.js | 19 +++ .../Date/prototype/valueOf/S15.9.5.8_A1_T3.js | 20 ++++ .../Date/prototype/valueOf/S15.9.5.8_A2_T1.js | 18 +++ .../Date/prototype/valueOf/S15.9.5.8_A3_T1.js | 24 ++++ .../Date/prototype/valueOf/S15.9.5.8_A3_T2.js | 25 ++++ .../Date/prototype/valueOf/S15.9.5.8_A3_T3.js | 22 ++++ .../built-ins/Date/prototype/valueOf/S9.4_A3_T1.js | 61 ++++++++++ .../built-ins/Date/prototype/valueOf/S9.4_A3_T2.js | 35 ++++++ .../built-ins/Date/prototype/valueOf/browser.js | 0 .../built-ins/Date/prototype/valueOf/name.js | 28 +++++ .../Date/prototype/valueOf/not-a-constructor.js | 35 ++++++ .../built-ins/Date/prototype/valueOf/shell.js | 0 744 files changed, 18670 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A01_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A02_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A03_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A04_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A05_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A06_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A07_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A08_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A09_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A10_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A11_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A12_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A13_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A14_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A15_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A16_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A17_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A18_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A19_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A20_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A21_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A22_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A23_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A24_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A25_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A26_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A27_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A28_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A29_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A30_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A31_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A32_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A33_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A34_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A35_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A36_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A37_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A38_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A39_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A40_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A41_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A42_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/called-as-function.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-invalid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-non-callable.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-valid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-no-callables.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-invalid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-invalid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-non-callable.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-valid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-no-callables.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-invalid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-non-callable.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-valid.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-no-callables.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/length.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/this-val-non-obj.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/constructor/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/no-date-value.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-hour.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-min.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-ms.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-sec.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-month.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-ms.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-sec.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number-err.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/new-value-time-clip.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-valid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCDate/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCHours/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/format.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/negative-year.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toDateString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toISOString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/builtin.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/called-as-function.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-abrupt.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-arguments.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-result.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/length.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/non-finite.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/to-object.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-abrupt.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-symbol.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-value-of.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/format.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/negative-year.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/non-date-receiver.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toTimeString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/day-names.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/format.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/invalid-date.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/month-names.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/negative-year.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/toUTCString/shell.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A2_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T3.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T1.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/browser.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/name.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Date/prototype/valueOf/shell.js (limited to 'js/src/tests/test262/built-ins/Date/prototype') diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T1.js new file mode 100644 index 0000000000..20b8f72b64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date property "prototype" has { DontEnum, DontDelete, ReadOnly } + attributes +esid: sec-date.prototype +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype; +verifyNotWritable(Date, "prototype", null, 1); +assert.sameValue(Date.prototype, x, 'The value of Date.prototype is expected to equal the value of x'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T2.js new file mode 100644 index 0000000000..8696fba7d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date property "prototype" has { DontEnum, DontDelete, ReadOnly } + attributes +esid: sec-date.prototype +description: Checking DontDelete attribute +includes: [propertyHelper.js] +---*/ + +verifyNotConfigurable(Date, "prototype"); + +try { + assert.sameValue(delete Date.prototype, false); +} catch (e) { + if (e instanceof Test262Error) { + throw e; + } + assert(e instanceof TypeError); +} + +if (!Date.hasOwnProperty('prototype')) { + throw new Test262Error('#2: The Date.prototype property has the attributes DontDelete'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T3.js new file mode 100644 index 0000000000..183ac600b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.4.1_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date property "prototype" has { DontEnum, DontDelete, ReadOnly } + attributes +esid: sec-date.prototype +description: Checking DontEnum attribute +---*/ +assert( + !Date.propertyIsEnumerable('prototype'), + 'The value of !Date.propertyIsEnumerable(\'prototype\') is expected to be true' +); + +for (var x in Date) { + assert.notSameValue(x, "prototype", 'The value of x is not "prototype"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A01_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A01_T1.js new file mode 100644 index 0000000000..af08da6261 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A01_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "constructor" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "constructor" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("constructor"), + true, + 'Date.prototype.hasOwnProperty("constructor") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A02_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A02_T1.js new file mode 100644 index 0000000000..e6ea7e46e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A02_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toString"), + true, + 'Date.prototype.hasOwnProperty("toString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A03_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A03_T1.js new file mode 100644 index 0000000000..cefff13737 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A03_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toDateString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toDateString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toDateString"), + true, + 'Date.prototype.hasOwnProperty("toDateString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A04_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A04_T1.js new file mode 100644 index 0000000000..49029ad9e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A04_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toTimeString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toTimeString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toTimeString"), + true, + 'Date.prototype.hasOwnProperty("toTimeString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A05_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A05_T1.js new file mode 100644 index 0000000000..2085801083 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A05_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toLocaleString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toLocaleString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toLocaleString"), + true, + 'Date.prototype.hasOwnProperty("toLocaleString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A06_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A06_T1.js new file mode 100644 index 0000000000..8717c97ea0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A06_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toLocaleDateString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toLocaleDateString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toLocaleDateString"), + true, + 'Date.prototype.hasOwnProperty("toLocaleDateString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A07_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A07_T1.js new file mode 100644 index 0000000000..551e01e16b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A07_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toLocaleTimeString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toLocaleTimeString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toLocaleTimeString"), + true, + 'Date.prototype.hasOwnProperty("toLocaleTimeString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A08_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A08_T1.js new file mode 100644 index 0000000000..cb06300033 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A08_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "valueOf" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "valueOf" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("valueOf"), + true, + 'Date.prototype.hasOwnProperty("valueOf") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A09_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A09_T1.js new file mode 100644 index 0000000000..9e5f937095 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A09_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getTime" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getTime" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getTime"), + true, + 'Date.prototype.hasOwnProperty("getTime") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A10_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A10_T1.js new file mode 100644 index 0000000000..aab91858d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A10_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getFullYear" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getFullYear" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getFullYear"), + true, + 'Date.prototype.hasOwnProperty("getFullYear") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A11_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A11_T1.js new file mode 100644 index 0000000000..163b509df8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A11_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCFullYear" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCFullYear" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCFullYear"), + true, + 'Date.prototype.hasOwnProperty("getUTCFullYear") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A12_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A12_T1.js new file mode 100644 index 0000000000..20bd6222e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A12_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getMonth" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getMonth" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getMonth"), + true, + 'Date.prototype.hasOwnProperty("getMonth") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A13_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A13_T1.js new file mode 100644 index 0000000000..4eb1769699 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A13_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCMonth" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCMonth" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCMonth"), + true, + 'Date.prototype.hasOwnProperty("getUTCMonth") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A14_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A14_T1.js new file mode 100644 index 0000000000..3bb94bbc71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A14_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getDate" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getDate" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getDate"), + true, + 'Date.prototype.hasOwnProperty("getDate") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A15_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A15_T1.js new file mode 100644 index 0000000000..3a4e4c2adc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A15_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCDate" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCDate" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCDate"), + true, + 'Date.prototype.hasOwnProperty("getUTCDate") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A16_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A16_T1.js new file mode 100644 index 0000000000..7f9de5c682 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A16_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getDay" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getDay" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getDay"), + true, + 'Date.prototype.hasOwnProperty("getDay") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A17_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A17_T1.js new file mode 100644 index 0000000000..e1ddb8d672 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A17_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCDay" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCDay" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCDay"), + true, + 'Date.prototype.hasOwnProperty("getUTCDay") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A18_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A18_T1.js new file mode 100644 index 0000000000..be23a2dd36 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A18_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getHours" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getHours" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getHours"), + true, + 'Date.prototype.hasOwnProperty("getHours") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A19_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A19_T1.js new file mode 100644 index 0000000000..27d9c68a18 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A19_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCHours" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCHours" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCHours"), + true, + 'Date.prototype.hasOwnProperty("getUTCHours") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A20_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A20_T1.js new file mode 100644 index 0000000000..43a9ac8f1c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A20_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getMinutes" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getMinutes" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getMinutes"), + true, + 'Date.prototype.hasOwnProperty("getMinutes") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A21_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A21_T1.js new file mode 100644 index 0000000000..eeee6d1b0e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A21_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCMinutes" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCMinutes" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCMinutes"), + true, + 'Date.prototype.hasOwnProperty("getUTCMinutes") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A22_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A22_T1.js new file mode 100644 index 0000000000..433e6f9cce --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A22_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getSeconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getSeconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getSeconds"), + true, + 'Date.prototype.hasOwnProperty("getSeconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A23_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A23_T1.js new file mode 100644 index 0000000000..c8810bc298 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A23_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCSeconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCSeconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCSeconds"), + true, + 'Date.prototype.hasOwnProperty("getUTCSeconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A24_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A24_T1.js new file mode 100644 index 0000000000..c11983d1d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A24_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getMilliseconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getMilliseconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getMilliseconds"), + true, + 'Date.prototype.hasOwnProperty("getMilliseconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A25_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A25_T1.js new file mode 100644 index 0000000000..10aa185fd5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A25_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getUTCMilliseconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getUTCMilliseconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getUTCMilliseconds"), + true, + 'Date.prototype.hasOwnProperty("getUTCMilliseconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A26_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A26_T1.js new file mode 100644 index 0000000000..a7ff1e0f98 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A26_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "getTimezoneOffset" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "getTimezoneOffset" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("getTimezoneOffset"), + true, + 'Date.prototype.hasOwnProperty("getTimezoneOffset") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A27_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A27_T1.js new file mode 100644 index 0000000000..2178c458a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A27_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setTime" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setTime" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setTime"), + true, + 'Date.prototype.hasOwnProperty("setTime") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A28_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A28_T1.js new file mode 100644 index 0000000000..9d17f88883 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A28_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setMilliseconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setMilliseconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setMilliseconds"), + true, + 'Date.prototype.hasOwnProperty("setMilliseconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A29_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A29_T1.js new file mode 100644 index 0000000000..22c323c249 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A29_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCMilliseconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCMilliseconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCMilliseconds"), + true, + 'Date.prototype.hasOwnProperty("setUTCMilliseconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A30_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A30_T1.js new file mode 100644 index 0000000000..5d1de66b74 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A30_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setSeconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setSeconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setSeconds"), + true, + 'Date.prototype.hasOwnProperty("setSeconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A31_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A31_T1.js new file mode 100644 index 0000000000..aab6a583cf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A31_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCSeconds" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCSeconds" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCSeconds"), + true, + 'Date.prototype.hasOwnProperty("setUTCSeconds") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A32_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A32_T1.js new file mode 100644 index 0000000000..9ab447571d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A32_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setMinutes" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setMinutes" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setMinutes"), + true, + 'Date.prototype.hasOwnProperty("setMinutes") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A33_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A33_T1.js new file mode 100644 index 0000000000..6730e51d09 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A33_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCMinutes" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCMinutes" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCMinutes"), + true, + 'Date.prototype.hasOwnProperty("setUTCMinutes") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A34_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A34_T1.js new file mode 100644 index 0000000000..5c87f3aa67 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A34_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setHours" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setHours" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setHours"), + true, + 'Date.prototype.hasOwnProperty("setHours") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A35_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A35_T1.js new file mode 100644 index 0000000000..b190a80491 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A35_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCHours" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCHours" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCHours"), + true, + 'Date.prototype.hasOwnProperty("setUTCHours") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A36_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A36_T1.js new file mode 100644 index 0000000000..5ace73d7d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A36_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setDate" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setDate" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setDate"), + true, + 'Date.prototype.hasOwnProperty("setDate") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A37_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A37_T1.js new file mode 100644 index 0000000000..5185a5bf46 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A37_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCDate" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCDate" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCDate"), + true, + 'Date.prototype.hasOwnProperty("setUTCDate") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A38_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A38_T1.js new file mode 100644 index 0000000000..2adb512ccf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A38_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setMonth" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setMonth" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setMonth"), + true, + 'Date.prototype.hasOwnProperty("setMonth") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A39_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A39_T1.js new file mode 100644 index 0000000000..f2d7f80bc3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A39_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCMonth" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCMonth" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCMonth"), + true, + 'Date.prototype.hasOwnProperty("setUTCMonth") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A40_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A40_T1.js new file mode 100644 index 0000000000..d449d232ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A40_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setFullYear" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setFullYear" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setFullYear"), + true, + 'Date.prototype.hasOwnProperty("setFullYear") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A41_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A41_T1.js new file mode 100644 index 0000000000..d2178a8f2f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A41_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "setUTCFullYear" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "setUTCFullYear" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("setUTCFullYear"), + true, + 'Date.prototype.hasOwnProperty("setUTCFullYear") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A42_T1.js b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A42_T1.js new file mode 100644 index 0000000000..498c326b71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/S15.9.5_A42_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype has the property "toUTCString" +esid: sec-properties-of-the-date-prototype-object +description: The Date.prototype has the property "toUTCString" +---*/ +assert.sameValue( + Date.prototype.hasOwnProperty("toUTCString"), + true, + 'Date.prototype.hasOwnProperty("toUTCString") must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/browser.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/called-as-function.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/called-as-function.js new file mode 100644 index 0000000000..fcdf27ee65 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/called-as-function.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + `this` value is resolved using strict mode semantics, + throwing TypeError if called as top-level function. +info: | + Date.prototype [ @@toPrimitive ] ( hint ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + + ToObject ( argument ) + + Argument Type: Undefined + Result: Throw a TypeError exception. +features: [Symbol, Symbol.toPrimitive] +---*/ + +["toString", "valueOf"].forEach(function(key) { + Object.defineProperty(this, key, { + get: function() { + throw new Test262Error(key + " lookup should not be performed"); + }, + }); +}, this); + +var toPrimitive = Date.prototype[Symbol.toPrimitive]; +assert.throws(TypeError, function() { + toPrimitive("default"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-invalid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-invalid.js new file mode 100644 index 0000000000..5d17cdd87d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-invalid.js @@ -0,0 +1,40 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "default" and first try returns an invalid value +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voCallCount = 0; +var tsCallCount = 0; +var obj = { + valueOf: function() { + voCallCount += 1; + return 'valueOf test262'; + }, + toString: function() { + tsCallCount += 1; + return {}; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'default'), + 'valueOf test262', + '`valueOf` is used as a fallback when `toString` returns an object' +); +assert.sameValue(voCallCount, 1, '`valueOf` method was invoked exactly once'); +assert.sameValue(tsCallCount, 1, '`toString` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-non-callable.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-non-callable.js new file mode 100644 index 0000000000..16a7430b84 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-non-callable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "default" and first try is not callable +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voCallCount = 0; +var obj = { + valueOf: function() { + voCallCount += 1; + return 'valueOf test262'; + }, + toString: null +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'default'), + 'valueOf test262', + '`valueOf` is used as a fallback when `toString` is not callable' +); +assert.sameValue(voCallCount, 1, '`valueOf` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-valid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-valid.js new file mode 100644 index 0000000000..3512ecb52d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-first-valid.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "default" and first try returns a valid value +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voAccessCount = 0; +var tsCallCount = 0;; +var obj = { + get valueOf() { + voAccessCount += 1; + }, + toString: function() { + tsCallCount += 1; + return 'toString test262'; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'default'), + 'toString test262' +); +assert.sameValue(voAccessCount, 0, '`valueOf` method was not referenced'); +assert.sameValue(tsCallCount, 1, '`toString` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-no-callables.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-no-callables.js new file mode 100644 index 0000000000..7950211228 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-default-no-callables.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "default" and neither first nor second try are callable. +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var obj = { + valueOf: null, + toString: null +}; + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(obj, 'default'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-invalid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-invalid.js new file mode 100644 index 0000000000..243a4ef206 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-invalid.js @@ -0,0 +1,57 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: Behavior when an invalid `hint` argument is specified +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. +features: [Symbol.toPrimitive] +---*/ + +var d = new Date(); + +assert.sameValue(typeof d[Symbol.toPrimitive], 'function'); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive](); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive](undefined); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive](null); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive](''); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive]('String'); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive]('defaultnumber'); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive](new String('number')); +}); + +assert.throws(TypeError, function() { + d[Symbol.toPrimitive]({ + toString: function() { + 'number'; + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-invalid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-invalid.js new file mode 100644 index 0000000000..d151a2cbec --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-invalid.js @@ -0,0 +1,40 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "number" and first try returns an invalid value +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voCallCount = 0; +var tsCallCount = 0; +var obj = { + valueOf: function() { + voCallCount += 1; + return {}; + }, + toString: function() { + tsCallCount += 1; + return 'toString test262'; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'number'), + 'toString test262', + '`toString` is used as a fallback when `valueOf` returns an object' +); +assert.sameValue(voCallCount, 1, '`valueOf` method was invoked exactly once'); +assert.sameValue(tsCallCount, 1, '`toString` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-non-callable.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-non-callable.js new file mode 100644 index 0000000000..a4071061e5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-non-callable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "number" and first try is not callable +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var tsCallCount = 0; +var obj = { + valueOf: null, + toString: function() { + tsCallCount += 1; + return 'toString test262'; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'number'), + 'toString test262', + '`toString` is used as a fallback when `valueOf` is not callable' +); +assert.sameValue(tsCallCount, 1, '`toString` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-valid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-valid.js new file mode 100644 index 0000000000..249e9e5bf9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-first-valid.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "number" and first try returns a valid value +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voCallCount = 0; +var tsAccessCount = 0; +var obj = { + valueOf: function() { + voCallCount += 1; + return 'valueOf test262'; + }, + get toString() { + tsAccessCount += 1; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'number'), + 'valueOf test262' +); +assert.sameValue(voCallCount, 1, '`valueOf` method was invoked exactly once'); +assert.sameValue(tsAccessCount, 0, '`toString` method was not referenced'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-no-callables.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-no-callables.js new file mode 100644 index 0000000000..c2eaba27ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-number-no-callables.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "number" and neither first nor second try are callable. +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var obj = { + valueOf: null, + toString: null +}; + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(obj, 'number'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-invalid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-invalid.js new file mode 100644 index 0000000000..714410b032 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-invalid.js @@ -0,0 +1,40 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "string" and first try returns an invalid value +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voCallCount = 0; +var tsCallCount = 0; +var obj = { + valueOf: function() { + voCallCount += 1; + return 'valueOf test262'; + }, + toString: function() { + tsCallCount += 1; + return {}; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'string'), + 'valueOf test262', + '`valueOf` is used as a fallback when `toString` returns an object' +); +assert.sameValue(voCallCount, 1, '`valueOf` method was invoked exactly once'); +assert.sameValue(tsCallCount, 1, '`toString` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-non-callable.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-non-callable.js new file mode 100644 index 0000000000..2619af0be7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-non-callable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "string" and first try is not callable +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voCallCount = 0; +var obj = { + valueOf: function() { + voCallCount += 1; + return 'valueOf test262'; + }, + toString: null +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'string'), + 'valueOf test262', + '`valueOf` is used as a fallback when `toString` is not callable' +); +assert.sameValue(voCallCount, 1, '`valueOf` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-valid.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-valid.js new file mode 100644 index 0000000000..dee4c72897 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-first-valid.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "string" and first try returns a valid value +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var voAccessCount = 0; +var tsCallCount = 0; +var obj = { + get valueOf() { + voAccessCount += 1; + }, + toString: function() { + tsCallCount += 1; + return 'toString test262'; + } +}; + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].call(obj, 'string'), + 'toString test262' +); +assert.sameValue(voAccessCount, 0, '`valueOf` method was not referenced'); +assert.sameValue(tsCallCount, 1, '`toString` method was invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-no-callables.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-no-callables.js new file mode 100644 index 0000000000..3ff8fb1bf6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/hint-string-no-callables.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: > + Behavior when `hint` is "string" and neither first nor second try are callable. +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If hint is the String value "string" or the String value "default", then + a. Let tryFirst be "string". + 4. Else if hint is the String value "number", then + a. Let tryFirst be "number". + 5. Else, throw a TypeError exception. + 6. Return OrdinaryToPrimitive(O, tryFirst). +features: [Symbol.toPrimitive] +---*/ + +var obj = { + valueOf: null, + toString: null +}; + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(obj, 'string'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/length.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/length.js new file mode 100644 index 0000000000..1e46f05120 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: Date.prototype[Symbol.toPrimitive] `length` property +info: | + ES6 section 17: + + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this value + is equal to the largest number of named arguments shown in the subclause + headings for the function description, including optional parameters. + + [...] + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +features: [Symbol.toPrimitive] +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype[Symbol.toPrimitive].length, 1); + +verifyNotEnumerable(Date.prototype[Symbol.toPrimitive], 'length'); +verifyNotWritable(Date.prototype[Symbol.toPrimitive], 'length'); +verifyConfigurable(Date.prototype[Symbol.toPrimitive], 'length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/name.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/name.js new file mode 100644 index 0000000000..e1e40be0fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: Date.prototype[Symbol.toPrimitive] `name` property +info: | + The value of the name property of this function is "[Symbol.toPrimitive]". + + ES6 Section 17: + + [...] + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +features: [Symbol.toPrimitive] +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + Date.prototype[Symbol.toPrimitive].name, '[Symbol.toPrimitive]' +); + +verifyNotEnumerable(Date.prototype[Symbol.toPrimitive], 'name'); +verifyNotWritable(Date.prototype[Symbol.toPrimitive], 'name'); +verifyConfigurable(Date.prototype[Symbol.toPrimitive], 'name'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/prop-desc.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/prop-desc.js new file mode 100644 index 0000000000..88fa1fffc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype-@@toprimitive +description: Date.prototype[Symbol.toPrimitive] property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toPrimitive] +---*/ + +verifyNotEnumerable(Date.prototype, Symbol.toPrimitive); +verifyNotWritable(Date.prototype, Symbol.toPrimitive); +verifyConfigurable(Date.prototype, Symbol.toPrimitive); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/shell.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/this-val-non-obj.js b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/this-val-non-obj.js new file mode 100644 index 0000000000..ae8cc55b6a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/Symbol.toPrimitive/this-val-non-obj.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype-@@toprimitive +description: Behavior when `this` value is not an Object +info: | + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. +features: [Symbol.toPrimitive] +---*/ + +assert.sameValue(typeof Date.prototype[Symbol.toPrimitive], 'function'); + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(undefined, 'string'); +}); + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(null, 'string'); +}); + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(86, 'string'); +}); + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call('', 'string'); +}); + +assert.throws(TypeError, function() { + Date.prototype[Symbol.toPrimitive].call(true, 'string'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/browser.js b/js/src/tests/test262/built-ins/Date/prototype/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T1.js new file mode 100644 index 0000000000..3eb5e9e73b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "constructor" has { DontEnum } attributes +esid: sec-date.prototype.constructor +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.constructor; +if (x === 1) { + Date.prototype.constructor = 2; +} else { + Date.prototype.constructor = 1; +} + +assert.notSameValue( + Date.prototype.constructor, + x, + 'The value of Date.prototype.constructor is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T2.js new file mode 100644 index 0000000000..5c5c11a6ca --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "constructor" has { DontEnum } attributes +esid: sec-date.prototype.constructor +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.constructor, + false, + 'The value of delete Date.prototype.constructor is not false' +); + +assert( + !Date.prototype.hasOwnProperty('constructor'), + 'The value of !Date.prototype.hasOwnProperty(\'constructor\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T3.js new file mode 100644 index 0000000000..4836a6f517 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "constructor" has { DontEnum } attributes +esid: sec-date.prototype.constructor +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('constructor'), + 'The value of !Date.prototype.propertyIsEnumerable(\'constructor\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "constructor", 'The value of x is not "constructor"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A2_T1.js new file mode 100644 index 0000000000..8bc40b00c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "constructor" is 7 +esid: sec-date.prototype.constructor +description: The "length" property of the "constructor" is 7 +---*/ +assert.sameValue( + Date.prototype.constructor.hasOwnProperty("length"), + true, + 'Date.prototype.constructor.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.constructor.length, + 7, + 'The value of Date.prototype.constructor.length is expected to be 7' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T1.js new file mode 100644 index 0000000000..fd40dfb3de --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.constructor property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.constructor +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.constructor.length; +verifyNotWritable(Date.prototype.constructor, "length", null, 1); + +assert.sameValue( + Date.prototype.constructor.length, + x, + 'The value of Date.prototype.constructor.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T2.js new file mode 100644 index 0000000000..c47d0ec996 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.constructor property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.constructor +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.constructor.length, + true, + 'The value of `delete Date.prototype.constructor.length` is expected to be true' +); + +assert( + !Date.prototype.constructor.hasOwnProperty('length'), + 'The value of !Date.prototype.constructor.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T3.js new file mode 100644 index 0000000000..3821e5da76 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/constructor/S15.9.5.1_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.constructor property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.constructor +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.constructor.propertyIsEnumerable('length'), + 'The value of !Date.prototype.constructor.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.constructor) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/browser.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/constructor/shell.js b/js/src/tests/test262/built-ins/Date/prototype/constructor/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T1.js new file mode 100644 index 0000000000..b87c3db9cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getDate" has { DontEnum } attributes +esid: sec-date.prototype.getdate +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getDate; +if (x === 1) { + Date.prototype.getDate = 2; +} else { + Date.prototype.getDate = 1; +} + +assert.notSameValue( + Date.prototype.getDate, + x, + 'The value of Date.prototype.getDate is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T2.js new file mode 100644 index 0000000000..57ffd0b6f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getDate" has { DontEnum } attributes +esid: sec-date.prototype.getdate +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getDate, false, 'The value of delete Date.prototype.getDate is not false'); + +assert( + !Date.prototype.hasOwnProperty('getDate'), + 'The value of !Date.prototype.hasOwnProperty(\'getDate\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T3.js new file mode 100644 index 0000000000..f094cafad8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getDate" has { DontEnum } attributes +esid: sec-date.prototype.getdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getDate'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getDate\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getDate", 'The value of x is not "getDate"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A2_T1.js new file mode 100644 index 0000000000..48dc9be48d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getDate" is 0 +esid: sec-date.prototype.getdate +description: The "length" property of the "getDate" is 0 +---*/ +assert.sameValue( + Date.prototype.getDate.hasOwnProperty("length"), + true, + 'Date.prototype.getDate.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.getDate.length, 0, 'The value of Date.prototype.getDate.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T1.js new file mode 100644 index 0000000000..910e6edaf8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getDate property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.getdate +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getDate.length; +verifyNotWritable(Date.prototype.getDate, "length", null, 1); + +assert.sameValue( + Date.prototype.getDate.length, + x, + 'The value of Date.prototype.getDate.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T2.js new file mode 100644 index 0000000000..3edcd8fe2e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getDate property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getdate +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getDate.length, + true, + 'The value of `delete Date.prototype.getDate.length` is expected to be true' +); + +assert( + !Date.prototype.getDate.hasOwnProperty('length'), + 'The value of !Date.prototype.getDate.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T3.js new file mode 100644 index 0000000000..4b9f0503ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/S15.9.5.14_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getDate property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.getdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getDate.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getDate.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getDate) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/name.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/name.js new file mode 100644 index 0000000000..3c1574d163 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getdate +description: > + Date.prototype.getDate.name is "getDate". +info: | + Date.prototype.getDate ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getDate.name, "getDate"); + +verifyNotEnumerable(Date.prototype.getDate, "name"); +verifyNotWritable(Date.prototype.getDate, "name"); +verifyConfigurable(Date.prototype.getDate, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/not-a-constructor.js new file mode 100644 index 0000000000..675f61b753 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getDate does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getDate), + false, + 'isConstructor(Date.prototype.getDate) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getDate(); +}, '`let date = new Date(Date.now()); new date.getDate()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-invalid-date.js new file mode 100644 index 0000000000..a0e9c653da --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getdate +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getDate(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-date.js new file mode 100644 index 0000000000..009b25c25a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getdate +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getDate = Date.prototype.getDate; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getDate, 'function'); + +assert.throws(TypeError, function() { + getDate.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getDate.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getDate.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-object.js new file mode 100644 index 0000000000..5804d7d97d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getdate +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getDate = Date.prototype.getDate; +var symbol = Symbol(); + +assert.sameValue(typeof getDate, 'function'); + +assert.throws(TypeError, function() { + getDate.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getDate.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getDate.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getDate.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getDate.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getDate.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-valid-date.js new file mode 100644 index 0000000000..1f765dc15c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDate/this-value-valid-date.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getdate +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return DateFromTime(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 6, 6).getDate(), 6, 'first millisecond'); +assert.sameValue( + new Date(2016, 6, 6, 0, 0, 0, -1).getDate(), 5, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 999).getDate(), 6, 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 1000).getDate(), 7, 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 1, 29).getDate(), 29, 'first millisecond (month boundary)' +); +assert.sameValue( + new Date(2016, 1, 29, 0, 0, 0, -1).getDate(), + 28, + 'previous millisecond (month boundary)' +); +assert.sameValue( + new Date(2016, 1, 29, 23, 59, 59, 999).getDate(), + 29, + 'final millisecond (month boundary)' +); +assert.sameValue( + new Date(2016, 1, 29, 23, 59, 59, 1000).getDate(), + 1, + 'subsequent millisecond (month boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js new file mode 100644 index 0000000000..7fc24d1c49 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: The Date.prototype property "getDay" has { DontEnum } attributes +es5id: 15.9.5.16_A1_T1 +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getDay; +if (x === 1) { + Date.prototype.getDay = 2; +} else { + Date.prototype.getDay = 1; +} + +assert.notSameValue( + Date.prototype.getDay, + x, + 'The value of Date.prototype.getDay is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js new file mode 100644 index 0000000000..d7e7f2b9c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: The Date.prototype property "getDay" has { DontEnum } attributes +es5id: 15.9.5.16_A1_T2 +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getDay, false, 'The value of delete Date.prototype.getDay is not false'); + +assert( + !Date.prototype.hasOwnProperty('getDay'), + 'The value of !Date.prototype.hasOwnProperty(\'getDay\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js new file mode 100644 index 0000000000..45b3e2956b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: The Date.prototype property "getDay" has { DontEnum } attributes +es5id: 15.9.5.16_A1_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getDay'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getDay\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getDay", 'The value of x is not "getDay"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js new file mode 100644 index 0000000000..420c63de1d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A2_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: The "length" property of the "getDay" is 0 +es5id: 15.9.5.16_A2_T1 +description: The "length" property of the "getDay" is 0 +---*/ +assert.sameValue( + Date.prototype.getDay.hasOwnProperty("length"), + true, + 'Date.prototype.getDay.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.getDay.length, 0, 'The value of Date.prototype.getDay.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js new file mode 100644 index 0000000000..05e4b08b05 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: | + The Date.prototype.getDay property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +es5id: 15.9.5.16_A3_T1 +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getDay.length; +verifyNotWritable(Date.prototype.getDay, "length", null, 1); + +assert.sameValue( + Date.prototype.getDay.length, + x, + 'The value of Date.prototype.getDay.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T2.js new file mode 100644 index 0000000000..e133e5c31e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: | + The Date.prototype.getDay property "length" has { ReadOnly, ! DontDelete, + DontEnum } attributes +es5id: 15.9.5.16_A3_T2 +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getDay.length, + true, + 'The value of `delete Date.prototype.getDay.length` is expected to be true' +); + +assert( + !Date.prototype.getDay.hasOwnProperty('length'), + 'The value of !Date.prototype.getDay.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.js new file mode 100644 index 0000000000..56b83dbf97 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/S15.9.5.16_A3_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +info: | + The Date.prototype.getDay property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +es5id: 15.9.5.16_A3_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getDay.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getDay.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getDay) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/name.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/name.js new file mode 100644 index 0000000000..89c16d7928 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getday +description: > + Date.prototype.getDay.name is "getDay". +info: | + Date.prototype.getDay ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getDay.name, "getDay"); + +verifyNotEnumerable(Date.prototype.getDay, "name"); +verifyNotWritable(Date.prototype.getDay, "name"); +verifyConfigurable(Date.prototype.getDay, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js new file mode 100644 index 0000000000..08a25137e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getDay does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getDay), + false, + 'isConstructor(Date.prototype.getDay) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getDay(); +}, '`let date = new Date(Date.now()); new date.getDay()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js new file mode 100644 index 0000000000..2040a95868 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getday +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getDay(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js new file mode 100644 index 0000000000..a800f5cc0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getday +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getDay = Date.prototype.getDay; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getDay, 'function'); + +assert.throws(TypeError, function() { + getDay.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getDay.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getDay.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js new file mode 100644 index 0000000000..708533f16f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getday +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getDay = Date.prototype.getDay; +var symbol = Symbol(); + +assert.sameValue(typeof getDay, 'function'); + +assert.throws(TypeError, function() { + getDay.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getDay.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getDay.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getDay.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getDay.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getDay.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js new file mode 100644 index 0000000000..9a792771d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getDay/this-value-valid-date.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getday +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return WeekDay(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 6, 6).getDay(), 3, 'first millisecond'); +assert.sameValue( + new Date(2016, 6, 6, 0, 0, 0, -1).getDay(), 2, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 999).getDay(), 3, 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 1000).getDay(), 4, 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 6, 9).getDay(), 6, 'first millisecond (week boundary)' +); +assert.sameValue( + new Date(2016, 6, 9, 0, 0, 0, -1).getDay(), + 5, + 'previous millisecond (week boundary)' +); +assert.sameValue( + new Date(2016, 6, 9, 23, 59, 59, 999).getDay(), + 6, + 'final millisecond (week boundary)' +); +assert.sameValue( + new Date(2016, 6, 9, 23, 59, 59, 1000).getDay(), + 0, + 'subsequent millisecond (week boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T1.js new file mode 100644 index 0000000000..7c5a812e3c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: The Date.prototype property "getFullYear" has { DontEnum } attributes +es5id: 15.9.5.10_A1_T1 +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getFullYear; +if (x === 1) { + Date.prototype.getFullYear = 2; +} else { + Date.prototype.getFullYear = 1; +} + +assert.notSameValue( + Date.prototype.getFullYear, + x, + 'The value of Date.prototype.getFullYear is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T2.js new file mode 100644 index 0000000000..bb2f4ca35a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: The Date.prototype property "getFullYear" has { DontEnum } attributes +es5id: 15.9.5.10_A1_T2 +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getFullYear, + false, + 'The value of delete Date.prototype.getFullYear is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getFullYear'), + 'The value of !Date.prototype.hasOwnProperty(\'getFullYear\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T3.js new file mode 100644 index 0000000000..0007014fc4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: The Date.prototype property "getFullYear" has { DontEnum } attributes +es5id: 15.9.5.10_A1_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getFullYear'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getFullYear\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getFullYear", 'The value of x is not "getFullYear"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A2_T1.js new file mode 100644 index 0000000000..dfa43ba710 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: The "length" property of the "getFullYear" is 0 +es5id: 15.9.5.10_A2_T1 +description: The "length" property of the "getFullYear" is 0 +---*/ +assert.sameValue( + Date.prototype.getFullYear.hasOwnProperty("length"), + true, + 'Date.prototype.getFullYear.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getFullYear.length, + 0, + 'The value of Date.prototype.getFullYear.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T1.js new file mode 100644 index 0000000000..96612522fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: | + The Date.prototype.getFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +es5id: 15.9.5.10_A3_T1 +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getFullYear.length; +verifyNotWritable(Date.prototype.getFullYear, "length", null, 1); + +assert.sameValue( + Date.prototype.getFullYear.length, + x, + 'The value of Date.prototype.getFullYear.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T2.js new file mode 100644 index 0000000000..7e3309aed2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: | + The Date.prototype.getFullYear property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +es5id: 15.9.5.10_A3_T2 +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getFullYear.length, + true, + 'The value of `delete Date.prototype.getFullYear.length` is expected to be true' +); + +assert( + !Date.prototype.getFullYear.hasOwnProperty('length'), + 'The value of !Date.prototype.getFullYear.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T3.js new file mode 100644 index 0000000000..aa8696ea56 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/S15.9.5.10_A3_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +info: | + The Date.prototype.getFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +es5id: 15.9.5.10_A3_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getFullYear.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getFullYear.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getFullYear) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/name.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/name.js new file mode 100644 index 0000000000..d6a5b8e6ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getfullyear +description: > + Date.prototype.getFullYear.name is "getFullYear". +info: | + Date.prototype.getFullYear ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getFullYear.name, "getFullYear"); + +verifyNotEnumerable(Date.prototype.getFullYear, "name"); +verifyNotWritable(Date.prototype.getFullYear, "name"); +verifyConfigurable(Date.prototype.getFullYear, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/not-a-constructor.js new file mode 100644 index 0000000000..917047cfdb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getFullYear does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getFullYear), + false, + 'isConstructor(Date.prototype.getFullYear) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getFullYear(); +}, '`let date = new Date(Date.now()); new date.getFullYear()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-invalid-date.js new file mode 100644 index 0000000000..3a13ff8808 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getfullyear +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getFullYear(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-date.js new file mode 100644 index 0000000000..acc63be044 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getfullyear +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getFullYear = Date.prototype.getFullYear; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getFullYear, 'function'); + +assert.throws(TypeError, function() { + getFullYear.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getFullYear.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getFullYear.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-object.js new file mode 100644 index 0000000000..6f6c50d8bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getfullyear +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getFullYear = Date.prototype.getFullYear; +var symbol = Symbol(); + +assert.sameValue(typeof getFullYear, 'function'); + +assert.throws(TypeError, function() { + getFullYear.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getFullYear.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getFullYear.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getFullYear.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getFullYear.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getFullYear.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-valid-date.js new file mode 100644 index 0000000000..d3be3f5411 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getFullYear/this-value-valid-date.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getfullyear +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return YearFromTime(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 0).getFullYear(), 2016, 'first millisecond'); +assert.sameValue( + new Date(2016, 0, 1, 0, 0, 0, -1).getFullYear(), 2015, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 11, 31, 23, 59, 59, 999).getFullYear(), + 2016, + 'final millisecond' +); +assert.sameValue( + new Date(2016, 11, 31, 23, 59, 59, 1000).getFullYear(), + 2017, + 'subsequent millisecond' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js new file mode 100644 index 0000000000..b5d567e82b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: The Date.prototype property "getHours" has { DontEnum } attributes +es5id: 15.9.5.18_A1_T1 +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getHours; +if (x === 1) { + Date.prototype.getHours = 2; +} else { + Date.prototype.getHours = 1; +} + +assert.notSameValue( + Date.prototype.getHours, + x, + 'The value of Date.prototype.getHours is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js new file mode 100644 index 0000000000..6db2368458 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: The Date.prototype property "getHours" has { DontEnum } attributes +es5id: 15.9.5.18_A1_T2 +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getHours, false, 'The value of delete Date.prototype.getHours is not false'); + +assert( + !Date.prototype.hasOwnProperty('getHours'), + 'The value of !Date.prototype.hasOwnProperty(\'getHours\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js new file mode 100644 index 0000000000..2e4a4cb504 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: The Date.prototype property "getHours" has { DontEnum } attributes +es5id: 15.9.5.18_A1_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getHours'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getHours\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getHours", 'The value of x is not "getHours"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js new file mode 100644 index 0000000000..7a10e7fa70 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A2_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: The "length" property of the "getHours" is 0 +es5id: 15.9.5.18_A2_T1 +description: The "length" property of the "getHours" is 0 +---*/ +assert.sameValue( + Date.prototype.getHours.hasOwnProperty("length"), + true, + 'Date.prototype.getHours.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.getHours.length, 0, 'The value of Date.prototype.getHours.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js new file mode 100644 index 0000000000..91895b2dc4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: | + The Date.prototype.getHours property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +es5id: 15.9.5.18_A3_T1 +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getHours.length; +verifyNotWritable(Date.prototype.getHours, "length", null, 1); + +assert.sameValue( + Date.prototype.getHours.length, + x, + 'The value of Date.prototype.getHours.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.js new file mode 100644 index 0000000000..39c306667f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: | + The Date.prototype.getHours property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +es5id: 15.9.5.18_A3_T2 +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getHours.length, + true, + 'The value of `delete Date.prototype.getHours.length` is expected to be true' +); + +assert( + !Date.prototype.getHours.hasOwnProperty('length'), + 'The value of !Date.prototype.getHours.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js new file mode 100644 index 0000000000..10d0865799 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/S15.9.5.18_A3_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +info: | + The Date.prototype.getHours property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +es5id: 15.9.5.18_A3_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getHours.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getHours.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getHours) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/name.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/name.js new file mode 100644 index 0000000000..b775ade1e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gethours +description: > + Date.prototype.getHours.name is "getHours". +info: | + Date.prototype.getHours ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getHours.name, "getHours"); + +verifyNotEnumerable(Date.prototype.getHours, "name"); +verifyNotWritable(Date.prototype.getHours, "name"); +verifyConfigurable(Date.prototype.getHours, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js new file mode 100644 index 0000000000..bdb019bbee --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getHours does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getHours), + false, + 'isConstructor(Date.prototype.getHours) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getHours(); +}, '`let date = new Date(Date.now()); new date.getHours()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js new file mode 100644 index 0000000000..6d27ad3309 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gethours +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getHours(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js new file mode 100644 index 0000000000..57ec097430 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gethours +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getHours = Date.prototype.getHours; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getHours, 'function'); + +assert.throws(TypeError, function() { + getHours.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getHours.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getHours.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js new file mode 100644 index 0000000000..772af36457 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gethours +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getHours = Date.prototype.getHours; +var symbol = Symbol(); + +assert.sameValue(typeof getHours, 'function'); + +assert.throws(TypeError, function() { + getHours.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getHours.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getHours.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getHours.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getHours.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getHours.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js new file mode 100644 index 0000000000..105e1434b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getHours/this-value-valid-date.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gethours +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return HourFromTime(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 6, 6, 13).getHours(), 13, 'first millisecond'); +assert.sameValue( + new Date(2016, 6, 6, 13, 0, 0, -1).getHours(), 12, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 13, 59, 59, 999).getHours(), + 13, + 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 13, 59, 59, 1000).getHours(), + 14, + 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 6, 6, 23).getHours(), 23, 'first millisecond (hour boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 0, 0, -1).getHours(), + 22, + 'previous millisecond (hour boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 999).getHours(), + 23, + 'final millisecond (hour boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 1000).getHours(), + 0, + 'subsequent millisecond (hour boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T1.js new file mode 100644 index 0000000000..d6ce91e98b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: The Date.prototype property "getMilliseconds" has { DontEnum } attributes +es5id: 15.9.5.24_A1_T1 +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getMilliseconds; +if (x === 1) { + Date.prototype.getMilliseconds = 2; +} else { + Date.prototype.getMilliseconds = 1; +} + +assert.notSameValue( + Date.prototype.getMilliseconds, + x, + 'The value of Date.prototype.getMilliseconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T2.js new file mode 100644 index 0000000000..f8c8c27b8f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: The Date.prototype property "getMilliseconds" has { DontEnum } attributes +es5id: 15.9.5.24_A1_T2 +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getMilliseconds, + false, + 'The value of delete Date.prototype.getMilliseconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getMilliseconds'), + 'The value of !Date.prototype.hasOwnProperty(\'getMilliseconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T3.js new file mode 100644 index 0000000000..0f39980bce --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: The Date.prototype property "getMilliseconds" has { DontEnum } attributes +es5id: 15.9.5.24_A1_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getMilliseconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getMilliseconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getMilliseconds", 'The value of x is not "getMilliseconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A2_T1.js new file mode 100644 index 0000000000..84f0bba125 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: The "length" property of the "getMilliseconds" is 0 +es5id: 15.9.5.24_A2_T1 +description: The "length" property of the "getMilliseconds" is 0 +---*/ +assert.sameValue( + Date.prototype.getMilliseconds.hasOwnProperty("length"), + true, + 'Date.prototype.getMilliseconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getMilliseconds.length, + 0, + 'The value of Date.prototype.getMilliseconds.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T1.js new file mode 100644 index 0000000000..692247a28a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: | + The Date.prototype.getMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +es5id: 15.9.5.24_A3_T1 +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getMilliseconds.length; +verifyNotWritable(Date.prototype.getMilliseconds, "length", null, 1); + +assert.sameValue( + Date.prototype.getMilliseconds.length, + x, + 'The value of Date.prototype.getMilliseconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T2.js new file mode 100644 index 0000000000..08208a9d9e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: | + The Date.prototype.getMilliseconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +es5id: 15.9.5.24_A3_T2 +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getMilliseconds.length, + true, + 'The value of `delete Date.prototype.getMilliseconds.length` is expected to be true' +); + +assert( + !Date.prototype.getMilliseconds.hasOwnProperty('length'), + 'The value of !Date.prototype.getMilliseconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T3.js new file mode 100644 index 0000000000..337e72a7e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/S15.9.5.24_A3_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +info: | + The Date.prototype.getMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +es5id: 15.9.5.24_A3_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getMilliseconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getMilliseconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getMilliseconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/name.js new file mode 100644 index 0000000000..0845a2c619 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmilliseconds +description: > + Date.prototype.getMilliseconds.name is "getMilliseconds". +info: | + Date.prototype.getMilliseconds ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getMilliseconds.name, "getMilliseconds"); + +verifyNotEnumerable(Date.prototype.getMilliseconds, "name"); +verifyNotWritable(Date.prototype.getMilliseconds, "name"); +verifyConfigurable(Date.prototype.getMilliseconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/not-a-constructor.js new file mode 100644 index 0000000000..4682cd3c1e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getMilliseconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getMilliseconds), + false, + 'isConstructor(Date.prototype.getMilliseconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getMilliseconds(); +}, '`let date = new Date(Date.now()); new date.getMilliseconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-invalid-date.js new file mode 100644 index 0000000000..9f01a58c9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmilliseconds +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getMilliseconds(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-date.js new file mode 100644 index 0000000000..369b0e0e0f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmilliseconds +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getMilliseconds = Date.prototype.getMilliseconds; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getMilliseconds, 'function'); + +assert.throws(TypeError, function() { + getMilliseconds.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getMilliseconds.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getMilliseconds.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-object.js new file mode 100644 index 0000000000..e61eeb017f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmilliseconds +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getMilliseconds = Date.prototype.getMilliseconds; +var symbol = Symbol(); + +assert.sameValue(typeof getMilliseconds, 'function'); + +assert.throws(TypeError, function() { + getMilliseconds.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getMilliseconds.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getMilliseconds.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getMilliseconds.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getMilliseconds.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getMilliseconds.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-valid-date.js new file mode 100644 index 0000000000..c5ffe86664 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMilliseconds/this-value-valid-date.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmilliseconds +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return msFromTime(LocalTime(t)). +---*/ + +assert.sameValue( + new Date(2016, 6, 6).getMilliseconds(), 0, 'first millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 0, 0, 0, -1).getMilliseconds(), + 999, + 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 999).getMilliseconds(), + 999, + 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 23, 59, 59, 1000).getMilliseconds(), + 0, + 'subsequent millisecond' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T1.js new file mode 100644 index 0000000000..1568ec836c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: The Date.prototype property "getMinutes" has { DontEnum } attributes +es5id: 15.9.5.20_A1_T1 +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getMinutes; +if (x === 1) { + Date.prototype.getMinutes = 2; +} else { + Date.prototype.getMinutes = 1; +} + +assert.notSameValue( + Date.prototype.getMinutes, + x, + 'The value of Date.prototype.getMinutes is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T2.js new file mode 100644 index 0000000000..d792c65f1c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: The Date.prototype property "getMinutes" has { DontEnum } attributes +es5id: 15.9.5.20_A1_T2 +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getMinutes, + false, + 'The value of delete Date.prototype.getMinutes is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getMinutes'), + 'The value of !Date.prototype.hasOwnProperty(\'getMinutes\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T3.js new file mode 100644 index 0000000000..2e79948084 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: The Date.prototype property "getMinutes" has { DontEnum } attributes +es5id: 15.9.5.20_A1_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getMinutes'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getMinutes\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getMinutes", 'The value of x is not "getMinutes"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A2_T1.js new file mode 100644 index 0000000000..8a85f1211a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: The "length" property of the "getMinutes" is 0 +es5id: 15.9.5.20_A2_T1 +description: The "length" property of the "getMinutes" is 0 +---*/ +assert.sameValue( + Date.prototype.getMinutes.hasOwnProperty("length"), + true, + 'Date.prototype.getMinutes.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getMinutes.length, + 0, + 'The value of Date.prototype.getMinutes.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T1.js new file mode 100644 index 0000000000..19b83040f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: | + The Date.prototype.getMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +es5id: 15.9.5.20_A3_T1 +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getMinutes.length; +verifyNotWritable(Date.prototype.getMinutes, "length", null, 1); + +assert.sameValue( + Date.prototype.getMinutes.length, + x, + 'The value of Date.prototype.getMinutes.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T2.js new file mode 100644 index 0000000000..c81cd920e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: | + The Date.prototype.getMinutes property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +es5id: 15.9.5.20_A3_T2 +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getMinutes.length, + true, + 'The value of `delete Date.prototype.getMinutes.length` is expected to be true' +); + +assert( + !Date.prototype.getMinutes.hasOwnProperty('length'), + 'The value of !Date.prototype.getMinutes.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T3.js new file mode 100644 index 0000000000..d100261b04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/S15.9.5.20_A3_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +info: | + The Date.prototype.getMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +es5id: 15.9.5.20_A3_T3 +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getMinutes.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getMinutes.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getMinutes) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/name.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/name.js new file mode 100644 index 0000000000..e1d71363bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getminutes +description: > + Date.prototype.getMinutes.name is "getMinutes". +info: | + Date.prototype.getMinutes ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getMinutes.name, "getMinutes"); + +verifyNotEnumerable(Date.prototype.getMinutes, "name"); +verifyNotWritable(Date.prototype.getMinutes, "name"); +verifyConfigurable(Date.prototype.getMinutes, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/not-a-constructor.js new file mode 100644 index 0000000000..21682d79fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getMinutes does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getMinutes), + false, + 'isConstructor(Date.prototype.getMinutes) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getMinutes(); +}, '`let date = new Date(Date.now()); new date.getMinutes()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-invalid-date.js new file mode 100644 index 0000000000..ac7436d8fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getminutes +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getMinutes(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-date.js new file mode 100644 index 0000000000..879db67716 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getminutes +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getMinutes = Date.prototype.getMinutes; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getMinutes, 'function'); + +assert.throws(TypeError, function() { + getMinutes.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getMinutes.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getMinutes.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-object.js new file mode 100644 index 0000000000..606152bf68 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getminutes +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getMinutes = Date.prototype.getMinutes; +var symbol = Symbol(); + +assert.sameValue(typeof getMinutes, 'function'); + +assert.throws(TypeError, function() { + getMinutes.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getMinutes.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getMinutes.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getMinutes.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getMinutes.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getMinutes.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-valid-date.js new file mode 100644 index 0000000000..ded979d03c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMinutes/this-value-valid-date.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getminutes +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return MinFromTime(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 6, 6, 14, 6).getMinutes(), 6, 'first millisecond'); +assert.sameValue( + new Date(2016, 6, 6, 14, 6, 0, -1).getMinutes(), 5, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 6, 59, 999).getMinutes(), 6, 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 6, 59, 1000).getMinutes(), 7, 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 6, 6, 14, 59).getMinutes(), 59, 'first millisecond (hour boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 59, 0, -1).getMinutes(), + 58, + 'previous millisecond (hour boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 59, 59, 999).getMinutes(), + 59, + 'final millisecond (hour boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 59, 59, 1000).getMinutes(), + 0, + 'subsequent millisecond (hour boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T1.js new file mode 100644 index 0000000000..746c749d42 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getMonth" has { DontEnum } attributes +esid: sec-date.prototype.getmonth +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getMonth; +if (x === 1) { + Date.prototype.getMonth = 2; +} else { + Date.prototype.getMonth = 1; +} + +assert.notSameValue( + Date.prototype.getMonth, + x, + 'The value of Date.prototype.getMonth is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T2.js new file mode 100644 index 0000000000..d7cc73e91f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getMonth" has { DontEnum } attributes +esid: sec-date.prototype.getmonth +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getMonth, false, 'The value of delete Date.prototype.getMonth is not false'); + +assert( + !Date.prototype.hasOwnProperty('getMonth'), + 'The value of !Date.prototype.hasOwnProperty(\'getMonth\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T3.js new file mode 100644 index 0000000000..24081e0d12 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getMonth" has { DontEnum } attributes +esid: sec-date.prototype.getmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getMonth'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getMonth\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getMonth", 'The value of x is not "getMonth"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A2_T1.js new file mode 100644 index 0000000000..a7db351a63 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getMonth" is 0 +esid: sec-date.prototype.getmonth +description: The "length" property of the "getMonth" is 0 +---*/ +assert.sameValue( + Date.prototype.getMonth.hasOwnProperty("length"), + true, + 'Date.prototype.getMonth.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.getMonth.length, 0, 'The value of Date.prototype.getMonth.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T1.js new file mode 100644 index 0000000000..7c282d67e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getMonth property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.getmonth +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getMonth.length; +verifyNotWritable(Date.prototype.getMonth, "length", null, 1); + +assert.sameValue( + Date.prototype.getMonth.length, + x, + 'The value of Date.prototype.getMonth.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T2.js new file mode 100644 index 0000000000..b19fb31de0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getMonth property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getmonth +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getMonth.length, + true, + 'The value of `delete Date.prototype.getMonth.length` is expected to be true' +); + +assert( + !Date.prototype.getMonth.hasOwnProperty('length'), + 'The value of !Date.prototype.getMonth.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T3.js new file mode 100644 index 0000000000..05979ef2ea --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/S15.9.5.12_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getMonth property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.getmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getMonth.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getMonth.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getMonth) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/name.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/name.js new file mode 100644 index 0000000000..7071c3d694 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getmonth +description: > + Date.prototype.getMonth.name is "getMonth". +info: | + Date.prototype.getMonth ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getMonth.name, "getMonth"); + +verifyNotEnumerable(Date.prototype.getMonth, "name"); +verifyNotWritable(Date.prototype.getMonth, "name"); +verifyConfigurable(Date.prototype.getMonth, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/not-a-constructor.js new file mode 100644 index 0000000000..53c9ac0819 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getMonth does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getMonth), + false, + 'isConstructor(Date.prototype.getMonth) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getMonth(); +}, '`let date = new Date(Date.now()); new date.getMonth()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-invalid-date.js new file mode 100644 index 0000000000..0e7b5b9f4b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmonth +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getMonth(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-date.js new file mode 100644 index 0000000000..6686d8c9e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmonth +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getMonth = Date.prototype.getMonth; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getMonth, 'function'); + +assert.throws(TypeError, function() { + getMonth.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getMonth.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getMonth.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-object.js new file mode 100644 index 0000000000..40b1779930 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmonth +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getMonth = Date.prototype.getMonth; +var symbol = Symbol(); + +assert.sameValue(typeof getMonth, 'function'); + +assert.throws(TypeError, function() { + getMonth.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getMonth.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getMonth.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getMonth.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getMonth.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getMonth.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-valid-date.js new file mode 100644 index 0000000000..ec29f27910 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getMonth/this-value-valid-date.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getmonth +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return MonthFromTime(LocalTime(t)). +---*/ + +assert.sameValue(new Date(2016, 6).getMonth(), 6, 'first millisecond'); +assert.sameValue( + new Date(2016, 6, 0, 0, 0, 0, -1).getMonth(), 5, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 31, 23, 59, 59, 999).getMonth(), 6, 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 31, 23, 59, 59, 1000).getMonth(), 7, 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 11, 31).getMonth(), 11, 'first millisecond (year boundary)' +); +assert.sameValue( + new Date(2016, 11, 0, 0, 0, 0, -1).getMonth(), + 10, + 'previous millisecond (year boundary)' +); +assert.sameValue( + new Date(2016, 11, 31, 23, 59, 59, 999).getMonth(), + 11, + 'final millisecond (year boundary)' +); +assert.sameValue( + new Date(2016, 11, 31, 23, 59, 59, 1000).getMonth(), + 0, + 'subsequent millisecond (year boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js new file mode 100644 index 0000000000..b372371f87 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getSeconds; +if (x === 1) { + Date.prototype.getSeconds = 2; +} else { + Date.prototype.getSeconds = 1; +} + +assert.notSameValue( + Date.prototype.getSeconds, + x, + 'The value of Date.prototype.getSeconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T2.js new file mode 100644 index 0000000000..0b096b7988 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getSeconds, + false, + 'The value of delete Date.prototype.getSeconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getSeconds'), + 'The value of !Date.prototype.hasOwnProperty(\'getSeconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js new file mode 100644 index 0000000000..58daf773d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getSeconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getSeconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getSeconds", 'The value of x is not "getSeconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js new file mode 100644 index 0000000000..54125a0509 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getSeconds" is 0 +esid: sec-date.prototype.getseconds +description: The "length" property of the "getSeconds" is 0 +---*/ +assert.sameValue( + Date.prototype.getSeconds.hasOwnProperty("length"), + true, + 'Date.prototype.getSeconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getSeconds.length, + 0, + 'The value of Date.prototype.getSeconds.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js new file mode 100644 index 0000000000..557aa53531 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getSeconds.length; +verifyNotWritable(Date.prototype.getSeconds, "length", null, 1); + +assert.sameValue( + Date.prototype.getSeconds.length, + x, + 'The value of Date.prototype.getSeconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T2.js new file mode 100644 index 0000000000..cb6f6497ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getSeconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getSeconds.length, + true, + 'The value of `delete Date.prototype.getSeconds.length` is expected to be true' +); + +assert( + !Date.prototype.getSeconds.hasOwnProperty('length'), + 'The value of !Date.prototype.getSeconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T3.js new file mode 100644 index 0000000000..c6b40d5dba --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/S15.9.5.22_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getSeconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getSeconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getSeconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js new file mode 100644 index 0000000000..56d30ef47f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getseconds +description: > + Date.prototype.getSeconds.name is "getSeconds". +info: | + Date.prototype.getSeconds ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getSeconds.name, "getSeconds"); + +verifyNotEnumerable(Date.prototype.getSeconds, "name"); +verifyNotWritable(Date.prototype.getSeconds, "name"); +verifyConfigurable(Date.prototype.getSeconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js new file mode 100644 index 0000000000..cae3edd42d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getSeconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getSeconds), + false, + 'isConstructor(Date.prototype.getSeconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getSeconds(); +}, '`let date = new Date(Date.now()); new date.getSeconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js new file mode 100644 index 0000000000..6446cd025c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getseconds +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getSeconds(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js new file mode 100644 index 0000000000..f3931afe03 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getseconds +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getSeconds = Date.prototype.getSeconds; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getSeconds, 'function'); + +assert.throws(TypeError, function() { + getSeconds.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getSeconds.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getSeconds.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js new file mode 100644 index 0000000000..cc754be716 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getseconds +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getSeconds = Date.prototype.getSeconds; +var symbol = Symbol(); + +assert.sameValue(typeof getSeconds, 'function'); + +assert.throws(TypeError, function() { + getSeconds.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getSeconds.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getSeconds.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getSeconds.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getSeconds.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getSeconds.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js new file mode 100644 index 0000000000..3bddccc6c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getSeconds/this-value-valid-date.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getseconds +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return SecFromTime(LocalTime(t)). +---*/ + +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 30).getSeconds(), + 30, + 'first millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 30, -1).getSeconds(), 29, 'previous millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 30, 999).getSeconds(), 30, 'final millisecond' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 30, 1000).getSeconds(), + 31, + 'subsequent millisecond' +); + +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 59).getSeconds(), + 59, + 'first millisecond (minute boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 59, -1).getSeconds(), + 58, + 'previous millisecond (minute boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 59, 999).getSeconds(), + 59, + 'final millisecond (minute boundary)' +); +assert.sameValue( + new Date(2016, 6, 6, 14, 16, 59, 1000).getSeconds(), + 0, + 'subsequent millisecond (minute boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T1.js new file mode 100644 index 0000000000..988395a709 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getTime" has { DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getTime; +if (x === 1) { + Date.prototype.getTime = 2; +} else { + Date.prototype.getTime = 1; +} + +assert.notSameValue( + Date.prototype.getTime, + x, + 'The value of Date.prototype.getTime is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T2.js new file mode 100644 index 0000000000..37072a751c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getTime" has { DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getTime, false, 'The value of delete Date.prototype.getTime is not false'); + +assert( + !Date.prototype.hasOwnProperty('getTime'), + 'The value of !Date.prototype.hasOwnProperty(\'getTime\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T3.js new file mode 100644 index 0000000000..db5608efbd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getTime" has { DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getTime'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getTime\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getTime", 'The value of x is not "getTime"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A2_T1.js new file mode 100644 index 0000000000..0c5c84f24a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getTime" is 0 +esid: sec-date.prototype.getseconds +description: The "length" property of the "getTime" is 0 +---*/ +assert.sameValue( + Date.prototype.getTime.hasOwnProperty("length"), + true, + 'Date.prototype.getTime.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.getTime.length, 0, 'The value of Date.prototype.getTime.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T1.js new file mode 100644 index 0000000000..05081b50ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getTime property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getTime.length; +verifyNotWritable(Date.prototype.getTime, "length", null, 1); + +assert.sameValue( + Date.prototype.getTime.length, + x, + 'The value of Date.prototype.getTime.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T2.js new file mode 100644 index 0000000000..ef3c553cdb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getTime property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getTime.length, + true, + 'The value of `delete Date.prototype.getTime.length` is expected to be true' +); + +assert( + !Date.prototype.getTime.hasOwnProperty('length'), + 'The value of !Date.prototype.getTime.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T3.js new file mode 100644 index 0000000000..3df558d0cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/S15.9.5.9_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getTime property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.getseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getTime.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getTime.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getTime) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/name.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/name.js new file mode 100644 index 0000000000..3c05eb5508 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getseconds +description: > + Date.prototype.getTime.name is "getTime". +info: | + Date.prototype.getTime ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getTime.name, "getTime"); + +verifyNotEnumerable(Date.prototype.getTime, "name"); +verifyNotWritable(Date.prototype.getTime, "name"); +verifyConfigurable(Date.prototype.getTime, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/not-a-constructor.js new file mode 100644 index 0000000000..31e56a6eb3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getTime does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getTime), + false, + 'isConstructor(Date.prototype.getTime) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getTime(); +}, '`let date = new Date(Date.now()); new date.getTime()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-invalid-date.js new file mode 100644 index 0000000000..a86c5a17e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-invalid-date.js @@ -0,0 +1,12 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettime +description: Return value for invalid date +info: | + 1. Return ? thisTimeValue(this value). +---*/ + +assert.sameValue(new Date(NaN).getTime(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-date.js new file mode 100644 index 0000000000..408bd99cd4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettime +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Return ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getTime = Date.prototype.getTime; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getTime, 'function'); + +assert.throws(TypeError, function() { + getTime.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getTime.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getTime.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-object.js new file mode 100644 index 0000000000..8c39bcf37d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettime +description: Behavior when "this" value is not an Object +info: | + 1. Return ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getTime = Date.prototype.getTime; +var symbol = Symbol(); + +assert.sameValue(typeof getTime, 'function'); + +assert.throws(TypeError, function() { + getTime.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getTime.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getTime.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getTime.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getTime.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getTime.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-valid-date.js new file mode 100644 index 0000000000..a72cb3adb5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTime/this-value-valid-date.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettime +description: Return value for valid dates +info: | + 1. Return ? thisTimeValue(this value). +---*/ + +assert.sameValue(new Date(0).getTime(), 0, '+0'); +assert.sameValue(new Date(-0).getTime(), 0, '-0'); +assert.sameValue(new Date(-1).getTime(), -1); +assert.sameValue(new Date(1).getTime(), 1); +assert.sameValue(new Date(8640000000000000).getTime(), 8640000000000000); +assert.sameValue(new Date(-8640000000000000).getTime(), -8640000000000000); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T1.js new file mode 100644 index 0000000000..eb9033ac95 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "getTimezoneOffset" has { DontEnum } + attributes +esid: sec-date.prototype.gettimezoneoffset +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getTimezoneOffset; +if (x === 1) { + Date.prototype.getTimezoneOffset = 2; +} else { + Date.prototype.getTimezoneOffset = 1; +} + +assert.notSameValue( + Date.prototype.getTimezoneOffset, + x, + 'The value of Date.prototype.getTimezoneOffset is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T2.js new file mode 100644 index 0000000000..d5f30d46e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "getTimezoneOffset" has { DontEnum } + attributes +esid: sec-date.prototype.gettimezoneoffset +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getTimezoneOffset, + false, + 'The value of delete Date.prototype.getTimezoneOffset is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getTimezoneOffset'), + 'The value of !Date.prototype.hasOwnProperty(\'getTimezoneOffset\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T3.js new file mode 100644 index 0000000000..e0d1ee4a14 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "getTimezoneOffset" has { DontEnum } + attributes +esid: sec-date.prototype.gettimezoneoffset +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getTimezoneOffset'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getTimezoneOffset\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getTimezoneOffset", 'The value of x is not "getTimezoneOffset"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A2_T1.js new file mode 100644 index 0000000000..8e7b596a42 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getTimezoneOffset" is 0 +esid: sec-date.prototype.gettimezoneoffset +description: The "length" property of the "getTimezoneOffset" is 0 +---*/ +assert.sameValue( + Date.prototype.getTimezoneOffset.hasOwnProperty("length"), + true, + 'Date.prototype.getTimezoneOffset.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getTimezoneOffset.length, + 0, + 'The value of Date.prototype.getTimezoneOffset.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T1.js new file mode 100644 index 0000000000..9996c8e550 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getTimezoneOffset property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.gettimezoneoffset +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getTimezoneOffset.length; +verifyNotWritable(Date.prototype.getTimezoneOffset, "length", null, 1); + +assert.sameValue( + Date.prototype.getTimezoneOffset.length, + x, + 'The value of Date.prototype.getTimezoneOffset.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T2.js new file mode 100644 index 0000000000..deeec64aa0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getTimezoneOffset property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.gettimezoneoffset +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getTimezoneOffset.length, + true, + 'The value of `delete Date.prototype.getTimezoneOffset.length` is expected to be true' +); + +assert( + !Date.prototype.getTimezoneOffset.hasOwnProperty('length'), + 'The value of !Date.prototype.getTimezoneOffset.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T3.js new file mode 100644 index 0000000000..3c9e7c9966 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/S15.9.5.26_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getTimezoneOffset property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.gettimezoneoffset +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getTimezoneOffset.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getTimezoneOffset.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getTimezoneOffset) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/name.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/name.js new file mode 100644 index 0000000000..0fe3e7046d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.gettimezoneoffset +description: > + Date.prototype.getTimezoneOffset.name is "getTimezoneOffset". +info: | + Date.prototype.getTimezoneOffset ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getTimezoneOffset.name, "getTimezoneOffset"); + +verifyNotEnumerable(Date.prototype.getTimezoneOffset, "name"); +verifyNotWritable(Date.prototype.getTimezoneOffset, "name"); +verifyConfigurable(Date.prototype.getTimezoneOffset, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/not-a-constructor.js new file mode 100644 index 0000000000..cd1dcd6992 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getTimezoneOffset does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getTimezoneOffset), + false, + 'isConstructor(Date.prototype.getTimezoneOffset) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getTimezoneOffset(); +}, '`let date = new Date(Date.now()); new date.getTimezoneOffset()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-invalid-date.js new file mode 100644 index 0000000000..d9f7baa4a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettimezoneoffset +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getTimezoneOffset(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-date.js new file mode 100644 index 0000000000..70b8230839 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettimezoneoffset +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getTimezoneOffset = Date.prototype.getTimezoneOffset; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getTimezoneOffset, 'function'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-object.js new file mode 100644 index 0000000000..ef9245450d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettimezoneoffset +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getTimezoneOffset = Date.prototype.getTimezoneOffset; +var symbol = Symbol(); + +assert.sameValue(typeof getTimezoneOffset, 'function'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getTimezoneOffset.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-valid-date.js new file mode 100644 index 0000000000..bf141b1038 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getTimezoneOffset/this-value-valid-date.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.gettimezoneoffset +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return (t - LocalTime(t)) / msPerMinute. +---*/ + +assert.sameValue( + typeof new Date(0).getTimezoneOffset(), 'number', 'Unix epoch' +); + +assert.sameValue( + typeof new Date(8640000000000000).getTimezoneOffset(), + 'number', + 'latest representable time' +); + +assert.sameValue( + typeof new Date(-8640000000000000).getTimezoneOffset(), + 'number', + 'earliest representable time' +); + +assert.sameValue( + typeof new Date().getTimezoneOffset(), 'number', 'current time' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T1.js new file mode 100644 index 0000000000..16aebb6fae --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.getutcdate +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCDate; +if (x === 1) { + Date.prototype.getUTCDate = 2; +} else { + Date.prototype.getUTCDate = 1; +} + +assert.notSameValue( + Date.prototype.getUTCDate, + x, + 'The value of Date.prototype.getUTCDate is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T2.js new file mode 100644 index 0000000000..b25440b9b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.getutcdate +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCDate, + false, + 'The value of delete Date.prototype.getUTCDate is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCDate'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCDate\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T3.js new file mode 100644 index 0000000000..48e68cc14f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.getutcdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCDate'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCDate\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCDate", 'The value of x is not "getUTCDate"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A2_T1.js new file mode 100644 index 0000000000..0810fab7ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCDate" is 0 +esid: sec-date.prototype.getutcdate +description: The "length" property of the "getUTCDate" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCDate.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCDate.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCDate.length, + 0, + 'The value of Date.prototype.getUTCDate.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T1.js new file mode 100644 index 0000000000..e71163dee8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCDate property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdate +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCDate.length; +verifyNotWritable(Date.prototype.getUTCDate, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCDate.length, + x, + 'The value of Date.prototype.getUTCDate.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T2.js new file mode 100644 index 0000000000..e9dfd484db --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCDate property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdate +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCDate.length, + true, + 'The value of `delete Date.prototype.getUTCDate.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCDate.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCDate.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T3.js new file mode 100644 index 0000000000..17f63b8d66 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/S15.9.5.15_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCDate property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCDate.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCDate.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCDate) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/name.js new file mode 100644 index 0000000000..3968908ce4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcdate +description: > + Date.prototype.getUTCDate.name is "getUTCDate". +info: | + Date.prototype.getUTCDate ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCDate.name, "getUTCDate"); + +verifyNotEnumerable(Date.prototype.getUTCDate, "name"); +verifyNotWritable(Date.prototype.getUTCDate, "name"); +verifyConfigurable(Date.prototype.getUTCDate, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/not-a-constructor.js new file mode 100644 index 0000000000..0590ac9a6e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCDate does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCDate), + false, + 'isConstructor(Date.prototype.getUTCDate) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCDate(); +}, '`let date = new Date(Date.now()); new date.getUTCDate()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-invalid-date.js new file mode 100644 index 0000000000..1c5baf2f48 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcdate +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCDate(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-date.js new file mode 100644 index 0000000000..28ed8a1c65 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcdate +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCDate = Date.prototype.getUTCDate; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCDate, 'function'); + +assert.throws(TypeError, function() { + getUTCDate.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCDate.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCDate.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-object.js new file mode 100644 index 0000000000..40726e54bf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcdate +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCDate = Date.prototype.getUTCDate; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCDate, 'function'); + +assert.throws(TypeError, function() { + getUTCDate.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCDate.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCDate.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCDate.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCDate.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCDate.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-valid-date.js new file mode 100644 index 0000000000..87cfe7790e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDate/this-value-valid-date.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcdate +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return DateFromTime(t). +---*/ + +var july6 = 1467763200000; +var feb29 = 1456704000000; +var dayMs = 24 * 60 * 60 * 1000; + +assert.sameValue(new Date(july6).getUTCDate(), 6, 'first millisecond'); +assert.sameValue( + new Date(july6 - 1).getUTCDate(), 5, 'previous millisecond' +); +assert.sameValue( + new Date(july6 + dayMs - 1).getUTCDate(), 6, 'final millisecond' +); +assert.sameValue( + new Date(july6 + dayMs).getUTCDate(), 7, 'subsequent millisecond' +); + +assert.sameValue( + new Date(feb29).getUTCDate(), 29, 'first millisecond (month boundary)' +); +assert.sameValue( + new Date(feb29 - 1).getUTCDate(), 28, 'previous millisecond (month boundary)' +); +assert.sameValue( + new Date(feb29 + dayMs - 1).getUTCDate(), + 29, + 'final millisecond (month boundary)' +); +assert.sameValue( + new Date(feb29 + dayMs).getUTCDate(), + 1, + 'subsequent millisecond (month boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js new file mode 100644 index 0000000000..cd9b0ff287 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCDay" has { DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCDay; +if (x === 1) { + Date.prototype.getUTCDay = 2; +} else { + Date.prototype.getUTCDay = 1; +} + +assert.notSameValue( + Date.prototype.getUTCDay, + x, + 'The value of Date.prototype.getUTCDay is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js new file mode 100644 index 0000000000..8863c901e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCDay" has { DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.getUTCDay, false, 'The value of delete Date.prototype.getUTCDay is not false'); + +assert( + !Date.prototype.hasOwnProperty('getUTCDay'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCDay\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js new file mode 100644 index 0000000000..4b29c9feef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCDay" has { DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCDay'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCDay\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCDay", 'The value of x is not "getUTCDay"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js new file mode 100644 index 0000000000..c99eb6aedc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCDay" is 0 +esid: sec-date.prototype.getutcdaty +description: The "length" property of the "getUTCDay" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCDay.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCDay.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCDay.length, + 0, + 'The value of Date.prototype.getUTCDay.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js new file mode 100644 index 0000000000..cdfc659d5b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCDay property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCDay.length; +verifyNotWritable(Date.prototype.getUTCDay, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCDay.length, + x, + 'The value of Date.prototype.getUTCDay.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js new file mode 100644 index 0000000000..0ba6464b61 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCDay property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCDay.length, + true, + 'The value of `delete Date.prototype.getUTCDay.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCDay.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCDay.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js new file mode 100644 index 0000000000..42c7b12a6d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/S15.9.5.17_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCDay property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcdaty +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCDay.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCDay.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCDay) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js new file mode 100644 index 0000000000..280b83ed76 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcdaty +description: > + Date.prototype.getUTCDay.name is "getUTCDay". +info: | + Date.prototype.getUTCDay ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCDay.name, "getUTCDay"); + +verifyNotEnumerable(Date.prototype.getUTCDay, "name"); +verifyNotWritable(Date.prototype.getUTCDay, "name"); +verifyConfigurable(Date.prototype.getUTCDay, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js new file mode 100644 index 0000000000..42d0a20852 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCDay does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCDay), + false, + 'isConstructor(Date.prototype.getUTCDay) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCDay(); +}, '`let date = new Date(Date.now()); new date.getUTCDay()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js new file mode 100644 index 0000000000..5db81078d5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcday +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCDay(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js new file mode 100644 index 0000000000..942e781079 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcday +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCDay = Date.prototype.getUTCDay; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCDay, 'function'); + +assert.throws(TypeError, function() { + getUTCDay.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCDay.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCDay.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js new file mode 100644 index 0000000000..64f3a903e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcdaty +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCDay = Date.prototype.getUTCDay; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCDay, 'function'); + +assert.throws(TypeError, function() { + getUTCDay.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCDay.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCDay.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCDay.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCDay.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCDay.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js new file mode 100644 index 0000000000..8576c6bee9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCDay/this-value-valid-date.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcday +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return WeekDay(t). +---*/ + +var july6 = 1467763200000; +var july9 = 1468022400000; +var dayMs = 24 * 60 * 60 * 1000; + +assert.sameValue(new Date(july6).getUTCDay(), 3, 'first millisecond'); +assert.sameValue( + new Date(july6 - 1).getUTCDay(), 2, 'previous millisecond' +); +assert.sameValue( + new Date(july6 + dayMs - 1).getUTCDay(), 3, 'final millisecond' +); +assert.sameValue( + new Date(july6 + dayMs).getUTCDay(), 4, 'subsequent millisecond' +); + +assert.sameValue( + new Date(july9).getUTCDay(), 6, 'first millisecond (week boundary)' +); +assert.sameValue( + new Date(july9 - 1).getUTCDay(), 5, 'previous millisecond (week boundary)' +); +assert.sameValue( + new Date(july9 + dayMs - 1).getUTCDay(), + 6, + 'final millisecond (week boundary)' +); +assert.sameValue( + new Date(july9 + dayMs).getUTCDay(), + 0, + 'subsequent millisecond (week boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T1.js new file mode 100644 index 0000000000..ef8e59efbd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCFullYear" has { DontEnum } attributes +esid: sec-date.prototype.getutcfullyear +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCFullYear; +if (x === 1) { + Date.prototype.getUTCFullYear = 2; +} else { + Date.prototype.getUTCFullYear = 1; +} + +assert.notSameValue( + Date.prototype.getUTCFullYear, + x, + 'The value of Date.prototype.getUTCFullYear is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T2.js new file mode 100644 index 0000000000..49733ea562 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCFullYear" has { DontEnum } attributes +esid: sec-date.prototype.getutcfullyear +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCFullYear, + false, + 'The value of delete Date.prototype.getUTCFullYear is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCFullYear'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCFullYear\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T3.js new file mode 100644 index 0000000000..7ddec587e5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCFullYear" has { DontEnum } attributes +esid: sec-date.prototype.getutcfullyear +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCFullYear'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCFullYear\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCFullYear", 'The value of x is not "getUTCFullYear"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A2_T1.js new file mode 100644 index 0000000000..9779569d9b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCFullYear" is 0 +esid: sec-date.prototype.getutcfullyear +description: The "length" property of the "getUTCFullYear" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCFullYear.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCFullYear.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCFullYear.length, + 0, + 'The value of Date.prototype.getUTCFullYear.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T1.js new file mode 100644 index 0000000000..ae085004cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcfullyear +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCFullYear.length; +verifyNotWritable(Date.prototype.getUTCFullYear, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCFullYear.length, + x, + 'The value of Date.prototype.getUTCFullYear.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T2.js new file mode 100644 index 0000000000..8c21d6d788 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCFullYear property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcfullyear +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCFullYear.length, + true, + 'The value of `delete Date.prototype.getUTCFullYear.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCFullYear.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCFullYear.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T3.js new file mode 100644 index 0000000000..317b78bd4f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/S15.9.5.11_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcfullyear +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCFullYear.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCFullYear.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCFullYear) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/name.js new file mode 100644 index 0000000000..a12fcc0b98 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcfullyear +description: > + Date.prototype.getUTCFullYear.name is "getUTCFullYear". +info: | + Date.prototype.getUTCFullYear ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCFullYear.name, "getUTCFullYear"); + +verifyNotEnumerable(Date.prototype.getUTCFullYear, "name"); +verifyNotWritable(Date.prototype.getUTCFullYear, "name"); +verifyConfigurable(Date.prototype.getUTCFullYear, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/not-a-constructor.js new file mode 100644 index 0000000000..6baf587e38 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCFullYear does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCFullYear), + false, + 'isConstructor(Date.prototype.getUTCFullYear) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCFullYear(); +}, '`let date = new Date(Date.now()); new date.getUTCFullYear()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-invalid-date.js new file mode 100644 index 0000000000..53365be35d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcfullyear +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCFullYear(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-date.js new file mode 100644 index 0000000000..911da2c6a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcfullyear +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCFullYear = Date.prototype.getUTCFullYear; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCFullYear, 'function'); + +assert.throws(TypeError, function() { + getUTCFullYear.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCFullYear.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-object.js new file mode 100644 index 0000000000..67e4215d61 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcfullyear +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCFullYear = Date.prototype.getUTCFullYear; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCFullYear, 'function'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCFullYear.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-valid-date.js new file mode 100644 index 0000000000..9ed72bf248 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCFullYear/this-value-valid-date.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcfullyear +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return YearFromTime(t). +---*/ + +var dec31 = 1483142400000; +var dayMs = 24 * 60 * 60 * 1000; + +assert.sameValue(new Date(dec31).getUTCFullYear(), 2016, 'first millisecond'); +assert.sameValue( + new Date(dec31 - 1).getUTCFullYear(), 2016, 'previous millisecond' +); +assert.sameValue( + new Date(dec31 + dayMs - 1).getUTCFullYear(), 2016, 'final millisecond' +); +assert.sameValue( + new Date(dec31 + dayMs).getUTCFullYear(), 2017, 'subsequent millisecond' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js new file mode 100644 index 0000000000..c3dc2fec3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCHours" has { DontEnum } attributes +esid: sec-date.prototype.getutchours +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCHours; +if (x === 1) { + Date.prototype.getUTCHours = 2; +} else { + Date.prototype.getUTCHours = 1; +} + +assert.notSameValue( + Date.prototype.getUTCHours, + x, + 'The value of Date.prototype.getUTCHours is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js new file mode 100644 index 0000000000..391e4c9ae6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCHours" has { DontEnum } attributes +esid: sec-date.prototype.getutchours +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCHours, + false, + 'The value of delete Date.prototype.getUTCHours is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCHours'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCHours\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js new file mode 100644 index 0000000000..881e02a43a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCHours" has { DontEnum } attributes +esid: sec-date.prototype.getutchours +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCHours'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCHours\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCHours", 'The value of x is not "getUTCHours"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js new file mode 100644 index 0000000000..8fc7619ec2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCHours" is 0 +esid: sec-date.prototype.getutchours +description: The "length" property of the "getUTCHours" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCHours.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCHours.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCHours.length, + 0, + 'The value of Date.prototype.getUTCHours.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js new file mode 100644 index 0000000000..17c8d64a95 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCHours property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutchours +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCHours.length; +verifyNotWritable(Date.prototype.getUTCHours, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCHours.length, + x, + 'The value of Date.prototype.getUTCHours.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js new file mode 100644 index 0000000000..b7bbcdcfdb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCHours property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutchours +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCHours.length, + true, + 'The value of `delete Date.prototype.getUTCHours.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCHours.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCHours.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js new file mode 100644 index 0000000000..d56f7edbef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/S15.9.5.19_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCHours property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutchours +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCHours.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCHours.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCHours) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js new file mode 100644 index 0000000000..d35e74baa5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutchours +description: > + Date.prototype.getUTCHours.name is "getUTCHours". +info: | + Date.prototype.getUTCHours ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCHours.name, "getUTCHours"); + +verifyNotEnumerable(Date.prototype.getUTCHours, "name"); +verifyNotWritable(Date.prototype.getUTCHours, "name"); +verifyConfigurable(Date.prototype.getUTCHours, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js new file mode 100644 index 0000000000..60ed6e667f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCHours does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCHours), + false, + 'isConstructor(Date.prototype.getUTCHours) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCHours(); +}, '`let date = new Date(Date.now()); new date.getUTCHours()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js new file mode 100644 index 0000000000..435093209c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutchours +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCHours(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js new file mode 100644 index 0000000000..1158d6a6ff --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutchours +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCHours = Date.prototype.getUTCHours; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCHours, 'function'); + +assert.throws(TypeError, function() { + getUTCHours.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCHours.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCHours.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js new file mode 100644 index 0000000000..fea152d46a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutchours +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCHours = Date.prototype.getUTCHours; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCHours, 'function'); + +assert.throws(TypeError, function() { + getUTCHours.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCHours.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCHours.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCHours.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCHours.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCHours.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js new file mode 100644 index 0000000000..19157cf787 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCHours/this-value-valid-date.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutchours +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return HourFromTime(t). +---*/ + +var hour15 = 1467817200000; +var hour23 = 1467846000000; +var hourMs = 60 * 60 * 1000; + +assert.sameValue(new Date(hour15).getUTCHours(), 15, 'first millisecond'); +assert.sameValue( + new Date(hour15 - 1).getUTCHours(), 14, 'previous millisecond' +); +assert.sameValue( + new Date(hour15 + hourMs - 1).getUTCHours(), 15, 'final millisecond' +); +assert.sameValue( + new Date(hour15 + hourMs).getUTCHours(), 16, 'subsequent millisecond' +); + +assert.sameValue( + new Date(hour23).getUTCHours(), 23, 'first millisecond (day boundary)' +); +assert.sameValue( + new Date(hour23 - 1).getUTCHours(), 22, 'previous millisecond (day boundary)' +); +assert.sameValue( + new Date(hour23 + hourMs - 1).getUTCHours(), + 23, + 'final millisecond (day boundary)' +); +assert.sameValue( + new Date(hour23 + hourMs).getUTCHours(), + 0, + 'subsequent millisecond (day boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js new file mode 100644 index 0000000000..d9028f85d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "getUTCMilliseconds" has { DontEnum } + attributes +esid: sec-date.prototype.getutcmilliseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCMilliseconds; +if (x === 1) { + Date.prototype.getUTCMilliseconds = 2; +} else { + Date.prototype.getUTCMilliseconds = 1; +} + +assert.notSameValue( + Date.prototype.getUTCMilliseconds, + x, + 'The value of Date.prototype.getUTCMilliseconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T2.js new file mode 100644 index 0000000000..54830aa061 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "getUTCMilliseconds" has { DontEnum } + attributes +esid: sec-date.prototype.getutcmilliseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCMilliseconds, + false, + 'The value of delete Date.prototype.getUTCMilliseconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCMilliseconds'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCMilliseconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js new file mode 100644 index 0000000000..7537023057 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "getUTCMilliseconds" has { DontEnum } + attributes +esid: sec-date.prototype.getutcmilliseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCMilliseconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCMilliseconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCMilliseconds", 'The value of x is not "getUTCMilliseconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js new file mode 100644 index 0000000000..6aca17be30 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCMilliseconds" is 0 +esid: sec-date.prototype.getutcmilliseconds +description: The "length" property of the "getUTCMilliseconds" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCMilliseconds.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCMilliseconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCMilliseconds.length, + 0, + 'The value of Date.prototype.getUTCMilliseconds.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js new file mode 100644 index 0000000000..751e632a31 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcmilliseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCMilliseconds.length; +verifyNotWritable(Date.prototype.getUTCMilliseconds, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCMilliseconds.length, + x, + 'The value of Date.prototype.getUTCMilliseconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T2.js new file mode 100644 index 0000000000..d04f69662d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMilliseconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcmilliseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCMilliseconds.length, + true, + 'The value of `delete Date.prototype.getUTCMilliseconds.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCMilliseconds.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCMilliseconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T3.js new file mode 100644 index 0000000000..6fb9ff17f2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/S15.9.5.25_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcmilliseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCMilliseconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCMilliseconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCMilliseconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js new file mode 100644 index 0000000000..1a723340a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcmilliseconds +description: > + Date.prototype.getUTCMilliseconds.name is "getUTCMilliseconds". +info: | + Date.prototype.getUTCMilliseconds ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCMilliseconds.name, "getUTCMilliseconds"); + +verifyNotEnumerable(Date.prototype.getUTCMilliseconds, "name"); +verifyNotWritable(Date.prototype.getUTCMilliseconds, "name"); +verifyConfigurable(Date.prototype.getUTCMilliseconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js new file mode 100644 index 0000000000..b9e17b9792 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCMilliseconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCMilliseconds), + false, + 'isConstructor(Date.prototype.getUTCMilliseconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCMilliseconds(); +}, '`let date = new Date(Date.now()); new date.getUTCMilliseconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js new file mode 100644 index 0000000000..5fff8c51bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmilliseconds +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCMilliseconds(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js new file mode 100644 index 0000000000..b1cf64e3b3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmilliseconds +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCMilliseconds = Date.prototype.getUTCMilliseconds; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCMilliseconds, 'function'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js new file mode 100644 index 0000000000..8ed9cbdc1a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmilliseconds +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCMilliseconds = Date.prototype.getUTCMilliseconds; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCMilliseconds, 'function'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCMilliseconds.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js new file mode 100644 index 0000000000..fdbe4b17fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMilliseconds/this-value-valid-date.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmmilliseconds +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return msFromTime(t). +---*/ + +var july6 = 1467763200000; + +assert.sameValue(new Date(july6).getUTCMilliseconds(), 0, 'first millisecond'); +assert.sameValue( + new Date(july6 - 1).getUTCMilliseconds(), 999, 'previous millisecond' +); +assert.sameValue( + new Date(july6 + 999).getUTCMilliseconds(), 999, 'final millisecond' +); +assert.sameValue( + new Date(july6 + 1000).getUTCMilliseconds(), 0, 'subsequent millisecond' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T1.js new file mode 100644 index 0000000000..2f639c3cbb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCMinutes" has { DontEnum } attributes +esid: sec-date.prototype.getutcminutes +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCMinutes; +if (x === 1) { + Date.prototype.getUTCMinutes = 2; +} else { + Date.prototype.getUTCMinutes = 1; +} + +assert.notSameValue( + Date.prototype.getUTCMinutes, + x, + 'The value of Date.prototype.getUTCMinutes is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T2.js new file mode 100644 index 0000000000..c49b894496 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCMinutes" has { DontEnum } attributes +esid: sec-date.prototype.getutcminutes +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCMinutes, + false, + 'The value of delete Date.prototype.getUTCMinutes is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCMinutes'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCMinutes\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T3.js new file mode 100644 index 0000000000..3d5acebb83 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCMinutes" has { DontEnum } attributes +esid: sec-date.prototype.getutcminutes +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCMinutes'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCMinutes\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCMinutes", 'The value of x is not "getUTCMinutes"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A2_T1.js new file mode 100644 index 0000000000..0779033d4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCMinutes" is 0 +esid: sec-date.prototype.getutcminutes +description: The "length" property of the "getUTCMinutes" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCMinutes.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCMinutes.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCMinutes.length, + 0, + 'The value of Date.prototype.getUTCMinutes.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T1.js new file mode 100644 index 0000000000..4c43a77de8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcminutes +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCMinutes.length; +verifyNotWritable(Date.prototype.getUTCMinutes, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCMinutes.length, + x, + 'The value of Date.prototype.getUTCMinutes.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T2.js new file mode 100644 index 0000000000..2c6a0ee7ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMinutes property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcminutes +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCMinutes.length, + true, + 'The value of `delete Date.prototype.getUTCMinutes.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCMinutes.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCMinutes.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T3.js new file mode 100644 index 0000000000..fc9ed2a7fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/S15.9.5.21_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcminutes +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCMinutes.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCMinutes.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCMinutes) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/name.js new file mode 100644 index 0000000000..5fc1ac7b8d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcminutes +description: > + Date.prototype.getUTCMinutes.name is "getUTCMinutes". +info: | + Date.prototype.getUTCMinutes ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCMinutes.name, "getUTCMinutes"); + +verifyNotEnumerable(Date.prototype.getUTCMinutes, "name"); +verifyNotWritable(Date.prototype.getUTCMinutes, "name"); +verifyConfigurable(Date.prototype.getUTCMinutes, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/not-a-constructor.js new file mode 100644 index 0000000000..be50d8d0e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCMinutes does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCMinutes), + false, + 'isConstructor(Date.prototype.getUTCMinutes) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCMinutes(); +}, '`let date = new Date(Date.now()); new date.getUTCMinutes()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-invalid-date.js new file mode 100644 index 0000000000..71021ea4e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcminutes +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCMinutes(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-date.js new file mode 100644 index 0000000000..aca3733e13 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcminutes +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCMinutes = Date.prototype.getUTCMinutes; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCMinutes, 'function'); + +assert.throws(TypeError, function() { + getUTCMinutes.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCMinutes.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-object.js new file mode 100644 index 0000000000..a39c1453ea --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcminutes +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCMinutes = Date.prototype.getUTCMinutes; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCMinutes, 'function'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCMinutes.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-valid-date.js new file mode 100644 index 0000000000..04792ccc2b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMinutes/this-value-valid-date.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcminutes +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return MinFromTime(t). +---*/ + +var threeTwentyTwo = 1467818520000; +var threeFiftyNine = 1467820740000; +var minMs = 60 * 1000; + +assert.sameValue( + new Date(threeTwentyTwo).getUTCMinutes(), 22, 'first millisecond' +); +assert.sameValue( + new Date(threeTwentyTwo - 1).getUTCMinutes(), 21, 'previous millisecond' +); +assert.sameValue( + new Date(threeTwentyTwo + minMs - 1).getUTCMinutes(), 22, 'final millisecond' +); +assert.sameValue( + new Date(threeTwentyTwo + minMs).getUTCMinutes(), + 23, + 'subsequent millisecond' +); + +assert.sameValue( + new Date(threeFiftyNine).getUTCMinutes(), + 59, + 'first millisecond (day boundary)' +); +assert.sameValue( + new Date(threeFiftyNine - 1).getUTCMinutes(), + 58, + 'previous millisecond (day boundary)' +); +assert.sameValue( + new Date(threeFiftyNine + minMs - 1).getUTCMinutes(), + 59, + 'final millisecond (day boundary)' +); +assert.sameValue( + new Date(threeFiftyNine + minMs).getUTCMinutes(), + 0, + 'subsequent millisecond (day boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T1.js new file mode 100644 index 0000000000..925d0587ab --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCMonth" has { DontEnum } attributes +esid: sec-date.prototype.getutcmonth +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCMonth; +if (x === 1) { + Date.prototype.getUTCMonth = 2; +} else { + Date.prototype.getUTCMonth = 1; +} + +assert.notSameValue( + Date.prototype.getUTCMonth, + x, + 'The value of Date.prototype.getUTCMonth is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T2.js new file mode 100644 index 0000000000..f5c1c14170 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCMonth" has { DontEnum } attributes +esid: sec-date.prototype.getutcmonth +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCMonth, + false, + 'The value of delete Date.prototype.getUTCMonth is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCMonth'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCMonth\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T3.js new file mode 100644 index 0000000000..472b1c1447 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCMonth" has { DontEnum } attributes +esid: sec-date.prototype.getutcmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCMonth'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCMonth\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCMonth", 'The value of x is not "getUTCMonth"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A2_T1.js new file mode 100644 index 0000000000..4fb366a9dc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCMonth" is 0 +esid: sec-date.prototype.getutcmonth +description: The "length" property of the "getUTCMonth" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCMonth.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCMonth.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCMonth.length, + 0, + 'The value of Date.prototype.getUTCMonth.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T1.js new file mode 100644 index 0000000000..9ddd5d2fa4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMonth property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcmonth +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCMonth.length; +verifyNotWritable(Date.prototype.getUTCMonth, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCMonth.length, + x, + 'The value of Date.prototype.getUTCMonth.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T2.js new file mode 100644 index 0000000000..b712a583b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMonth property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcmonth +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCMonth.length, + true, + 'The value of `delete Date.prototype.getUTCMonth.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCMonth.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCMonth.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T3.js new file mode 100644 index 0000000000..0d06b876db --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/S15.9.5.13_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCMonth property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCMonth.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCMonth.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCMonth) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/name.js new file mode 100644 index 0000000000..796815dd91 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcmonth +description: > + Date.prototype.getUTCMonth.name is "getUTCMonth". +info: | + Date.prototype.getUTCMonth ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCMonth.name, "getUTCMonth"); + +verifyNotEnumerable(Date.prototype.getUTCMonth, "name"); +verifyNotWritable(Date.prototype.getUTCMonth, "name"); +verifyConfigurable(Date.prototype.getUTCMonth, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/not-a-constructor.js new file mode 100644 index 0000000000..55428f88be --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCMonth does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCMonth), + false, + 'isConstructor(Date.prototype.getUTCMonth) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCMonth(); +}, '`let date = new Date(Date.now()); new date.getUTCMonth()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-invalid-date.js new file mode 100644 index 0000000000..68bfe82089 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmonth +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCMonth(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-date.js new file mode 100644 index 0000000000..ca28a0d6fd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmonth +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCMonth = Date.prototype.getUTCMonth; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCMonth, 'function'); + +assert.throws(TypeError, function() { + getUTCMonth.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCMonth.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCMonth.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-object.js new file mode 100644 index 0000000000..f1396ebdf2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmonth +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCMonth = Date.prototype.getUTCMonth; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCMonth, 'function'); + +assert.throws(TypeError, function() { + getUTCMonth.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCMonth.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCMonth.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCMonth.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCMonth.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCMonth.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-valid-date.js new file mode 100644 index 0000000000..4873c783a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCMonth/this-value-valid-date.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcmonth +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return MonthFromTime(t). +---*/ + +var july31 = 1469923200000; +var dec31 = 1483142400000; +var dayMs = 24 * 60 * 60 * 1000; + +assert.sameValue(new Date(july31).getUTCMonth(), 6, 'first millisecond'); +assert.sameValue( + new Date(july31 - 1).getUTCMonth(), 6, 'previous millisecond' +); +assert.sameValue( + new Date(july31 + dayMs - 1).getUTCMonth(), 6, 'final millisecond' +); +assert.sameValue( + new Date(july31 + dayMs).getUTCMonth(), 7, 'subsequent millisecond' +); + +assert.sameValue( + new Date(dec31).getUTCMonth(), 11, 'first millisecond (year boundary)' +); +assert.sameValue( + new Date(dec31 - 1).getUTCMonth(), 11, 'previous millisecond (year boundary)' +); +assert.sameValue( + new Date(dec31 + dayMs - 1).getUTCMonth(), + 11, + 'final millisecond (year boundary)' +); +assert.sameValue( + new Date(dec31 + dayMs).getUTCMonth(), + 0, + 'subsequent millisecond (year boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js new file mode 100644 index 0000000000..85b6e8fc61 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.getUTCSeconds; +if (x === 1) { + Date.prototype.getUTCSeconds = 2; +} else { + Date.prototype.getUTCSeconds = 1; +} + +assert.notSameValue( + Date.prototype.getUTCSeconds, + x, + 'The value of Date.prototype.getUTCSeconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T2.js new file mode 100644 index 0000000000..fb718d5d2c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.getUTCSeconds, + false, + 'The value of delete Date.prototype.getUTCSeconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('getUTCSeconds'), + 'The value of !Date.prototype.hasOwnProperty(\'getUTCSeconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js new file mode 100644 index 0000000000..98e0d3a302 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "getUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('getUTCSeconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'getUTCSeconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "getUTCSeconds", 'The value of x is not "getUTCSeconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js new file mode 100644 index 0000000000..ab2c4c4c93 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "getUTCSeconds" is 0 +esid: sec-date.prototype.getutcseconds +description: The "length" property of the "getUTCSeconds" is 0 +---*/ +assert.sameValue( + Date.prototype.getUTCSeconds.hasOwnProperty("length"), + true, + 'Date.prototype.getUTCSeconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.getUTCSeconds.length, + 0, + 'The value of Date.prototype.getUTCSeconds.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js new file mode 100644 index 0000000000..fdce7234f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.getUTCSeconds.length; +verifyNotWritable(Date.prototype.getUTCSeconds, "length", null, 1); + +assert.sameValue( + Date.prototype.getUTCSeconds.length, + x, + 'The value of Date.prototype.getUTCSeconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T2.js new file mode 100644 index 0000000000..45a794334f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCSeconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.getUTCSeconds.length, + true, + 'The value of `delete Date.prototype.getUTCSeconds.length` is expected to be true' +); + +assert( + !Date.prototype.getUTCSeconds.hasOwnProperty('length'), + 'The value of !Date.prototype.getUTCSeconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T3.js new file mode 100644 index 0000000000..fc43b2b266 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/S15.9.5.23_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.getUTCSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.getutcseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.getUTCSeconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.getUTCSeconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.getUTCSeconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js new file mode 100644 index 0000000000..11cdea38b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.getutcseconds +description: > + Date.prototype.getUTCSeconds.name is "getUTCSeconds". +info: | + Date.prototype.getUTCSeconds ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.getUTCSeconds.name, "getUTCSeconds"); + +verifyNotEnumerable(Date.prototype.getUTCSeconds, "name"); +verifyNotWritable(Date.prototype.getUTCSeconds, "name"); +verifyConfigurable(Date.prototype.getUTCSeconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js new file mode 100644 index 0000000000..be8ed19fe1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.getUTCSeconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.getUTCSeconds), + false, + 'isConstructor(Date.prototype.getUTCSeconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.getUTCSeconds(); +}, '`let date = new Date(Date.now()); new date.getUTCSeconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js new file mode 100644 index 0000000000..98403f3bd7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-invalid-date.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcseconds +description: Return value for invalid date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. +---*/ + +assert.sameValue(new Date(NaN).getUTCSeconds(), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js new file mode 100644 index 0000000000..d14a9885fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-date.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcseconds +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var getUTCSeconds = Date.prototype.getUTCSeconds; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof getUTCSeconds, 'function'); + +assert.throws(TypeError, function() { + getUTCSeconds.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + getUTCSeconds.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(args); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js new file mode 100644 index 0000000000..575fe16b64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-non-object.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcseconds +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var getUTCSeconds = Date.prototype.getUTCSeconds; +var symbol = Symbol(); + +assert.sameValue(typeof getUTCSeconds, 'function'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(''); +}, 'string'); + +assert.throws(TypeError, function() { + getUTCSeconds.call(symbol); +}, 'symbol'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js new file mode 100644 index 0000000000..5851451eea --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/getUTCSeconds/this-value-valid-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.getutcseconds +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, return NaN. + 3. Return SecFromTime(t). +---*/ + +var sec34 = 1467819394000; +var sec59 = 1467819419000; + +assert.sameValue(new Date(sec34).getUTCSeconds(), 34, 'first millisecond'); +assert.sameValue( + new Date(sec34 - 1).getUTCSeconds(), 33, 'previous millisecond' +); +assert.sameValue( + new Date(sec34 + 999).getUTCSeconds(), 34, 'final millisecond' +); +assert.sameValue( + new Date(sec34 + 1000).getUTCSeconds(), 35, 'subsequent millisecond' +); + +assert.sameValue( + new Date(sec59).getUTCSeconds(), 59, 'first millisecond (minute boundary)' +); +assert.sameValue( + new Date(sec59 - 1).getUTCSeconds(), + 58, + 'previous millisecond (minute boundary)' +); +assert.sameValue( + new Date(sec59 + 99).getUTCSeconds(), + 59, + 'final millisecond (minute boundary)' +); +assert.sameValue( + new Date(sec59 + 1000).getUTCSeconds(), + 0, + 'subsequent millisecond (minute boundary)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/no-date-value.js b/js/src/tests/test262/built-ins/Date/prototype/no-date-value.js new file mode 100644 index 0000000000..0ed5661d0a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/no-date-value.js @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-properties-of-the-date-prototype-object +description: > + The Date Prototype object does not have a [[DateValue]] internal slot. +info: | + Properties of the Date Prototype Object + + The Date prototype object: + [...] + * is not a Date instance and does not have a [[DateValue]] internal slot. + + Date.prototype.getTime ( ) + + 1. Return ? thisTimeValue(this value). + + The abstract operation thisTimeValue takes argument value. + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + [...] + 2. Throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + Date.prototype.getTime(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T1.js new file mode 100644 index 0000000000..801ffd0e17 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setDate" has { DontEnum } attributes +esid: sec-date.prototype.setdate +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setDate; +if (x === 1) { + Date.prototype.setDate = 2; +} else { + Date.prototype.setDate = 1; +} + +assert.notSameValue( + Date.prototype.setDate, + x, + 'The value of Date.prototype.setDate is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T2.js new file mode 100644 index 0000000000..d0ad33c7de --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setDate" has { DontEnum } attributes +esid: sec-date.prototype.setdate +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.setDate, false, 'The value of delete Date.prototype.setDate is not false'); + +assert( + !Date.prototype.hasOwnProperty('setDate'), + 'The value of !Date.prototype.hasOwnProperty(\'setDate\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T3.js new file mode 100644 index 0000000000..f6f9ffd930 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setDate" has { DontEnum } attributes +esid: sec-date.prototype.setdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setDate'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setDate\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setDate", 'The value of x is not "setDate"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A2_T1.js new file mode 100644 index 0000000000..a54d6a167d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setDate" is 1 +esid: sec-date.prototype.setdate +description: The "length" property of the "setDate" is 1 +---*/ +assert.sameValue( + Date.prototype.setDate.hasOwnProperty("length"), + true, + 'Date.prototype.setDate.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.setDate.length, 1, 'The value of Date.prototype.setDate.length is expected to be 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T1.js new file mode 100644 index 0000000000..97e9613bb6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setDate property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.setdate +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setDate.length; +verifyNotWritable(Date.prototype.setDate, "length", null, 1); + +assert.sameValue( + Date.prototype.setDate.length, + x, + 'The value of Date.prototype.setDate.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T2.js new file mode 100644 index 0000000000..5b82b4c5d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setDate property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setdate +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setDate.length, + true, + 'The value of `delete Date.prototype.setDate.length` is expected to be true' +); + +assert( + !Date.prototype.setDate.hasOwnProperty('length'), + 'The value of !Date.prototype.setDate.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T3.js new file mode 100644 index 0000000000..7bc1624b0b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/S15.9.5.36_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setDate property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.setdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setDate.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setDate.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setDate) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-coercion-order.js new file mode 100644 index 0000000000..094bec4454 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-coercion-order.js @@ -0,0 +1,32 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let dt be ? ToNumber(date). + 3. If t is NaN, return NaN. + 4. Set t to LocalTime(t). + 5. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t)). + 6. Let u be TimeClip(UTC(newDate)). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. +---*/ + +var date = new Date(NaN); +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 0; + } +}; + +var returnValue = date.setDate(arg); + +assert.sameValue(callCount, 1, 'ToNumber invoked exactly once'); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number-err.js new file mode 100644 index 0000000000..487518b9b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number-err.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: Abrupt completion during type coercion of provided argument +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setDate(obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number.js new file mode 100644 index 0000000000..84997779ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/arg-to-number.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: Type coercion of provided argument +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setDate(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, new Date(2016, 6, 2).getTime(), 'application of specified value' +); + +returnValue = date.setDate(null); + +assert.sameValue(returnValue, new Date(2016, 5, 30).getTime(), 'null'); + +returnValue = date.setDate(true); + +assert.sameValue(returnValue, new Date(2016, 5, 1).getTime(), 'true'); + +returnValue = date.setDate(false); + +assert.sameValue(returnValue, new Date(2016, 4, 31).getTime(), 'false'); + +returnValue = date.setDate(' +00200.000E-0002 '); + +assert.sameValue(returnValue, new Date(2016, 4, 2).getTime(), 'string'); + +returnValue = date.setDate(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/name.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/name.js new file mode 100644 index 0000000000..15ba085ab7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setdate +description: > + Date.prototype.setDate.name is "setDate". +info: | + Date.prototype.setDate ( date ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setDate.name, "setDate"); + +verifyNotEnumerable(Date.prototype.setDate, "name"); +verifyNotWritable(Date.prototype.setDate, "name"); +verifyConfigurable(Date.prototype.setDate, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/new-value-time-clip.js new file mode 100644 index 0000000000..d0c25070ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/new-value-time-clip.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var date = new Date(8.64e15); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setDate(28); + +assert.sameValue(returnValue, NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/not-a-constructor.js new file mode 100644 index 0000000000..cc4d2bca46 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setDate does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setDate), + false, + 'isConstructor(Date.prototype.setDate) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setDate(); +}, '`let date = new Date(Date.now()); new date.setDate()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-invalid-date.js new file mode 100644 index 0000000000..e3e8e953b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-invalid-date.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setDate(0); + +assert.sameValue(result, NaN, 'return value'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-date.js new file mode 100644 index 0000000000..66fd4e6881 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setDate = Date.prototype.setDate; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setDate, 'function'); + +assert.throws(TypeError, function() { + setDate.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setDate.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setDate.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-object.js new file mode 100644 index 0000000000..6033b0c9aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: Behavior when "this" value is not an Object +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setDate = Date.prototype.setDate; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setDate, 'function'); + +assert.throws(TypeError, function() { + setDate.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setDate.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setDate.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setDate.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setDate.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setDate.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-valid-date.js new file mode 100644 index 0000000000..8ce10fc6ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setDate/this-value-valid-date.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setdate +description: Return value for valid dates +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setDate(6); + +expected = new Date(2016, 6, 6).getTime(); +assert.sameValue( + returnValue, expected, 'within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setDate(0); + +expected = new Date(2016, 5, 30).getTime(); +assert.sameValue( + returnValue, expected, 'before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setDate(31); + +expected = new Date(2016, 6, 1).getTime(); +assert.sameValue( + returnValue, expected, 'after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js new file mode 100644 index 0000000000..793edd6fd7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/15.9.5.40_1.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setfullyear +description: > + Date.prototype.setFullYear - Date.prototype is itself not an + instance of Date +---*/ + + +assert.throws(TypeError, function() { + Date.prototype.setFullYear(2012); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js new file mode 100644 index 0000000000..b958ff7ac0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setFullYear" has { DontEnum } attributes +esid: sec-date.prototype.setfullyear +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setFullYear; +if (x === 1) { + Date.prototype.setFullYear = 2; +} else { + Date.prototype.setFullYear = 1; +} + +assert.notSameValue( + Date.prototype.setFullYear, + x, + 'The value of Date.prototype.setFullYear is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T2.js new file mode 100644 index 0000000000..ac18a41d6f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setFullYear" has { DontEnum } attributes +esid: sec-date.prototype.setfullyear +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setFullYear, + false, + 'The value of delete Date.prototype.setFullYear is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setFullYear'), + 'The value of !Date.prototype.hasOwnProperty(\'setFullYear\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js new file mode 100644 index 0000000000..f342b57550 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setFullYear" has { DontEnum } attributes +esid: sec-date.prototype.setfullyear +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setFullYear'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setFullYear\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setFullYear", 'The value of x is not "setFullYear"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js new file mode 100644 index 0000000000..f7f92225f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setFullYear" is 3 +esid: sec-date.prototype.setfullyear +description: The "length" property of the "setFullYear" is 3 +---*/ +assert.sameValue( + Date.prototype.setFullYear.hasOwnProperty("length"), + true, + 'Date.prototype.setFullYear.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setFullYear.length, + 3, + 'The value of Date.prototype.setFullYear.length is expected to be 3' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js new file mode 100644 index 0000000000..9f8c4bf99c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setfullyear +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setFullYear.length; +verifyNotWritable(Date.prototype.setFullYear, "length", null, 1); + +assert.sameValue( + Date.prototype.setFullYear.length, + x, + 'The value of Date.prototype.setFullYear.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T2.js new file mode 100644 index 0000000000..562b430dcf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setFullYear property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setfullyear +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setFullYear.length, + true, + 'The value of `delete Date.prototype.setFullYear.length` is expected to be true' +); + +assert( + !Date.prototype.setFullYear.hasOwnProperty('length'), + 'The value of !Date.prototype.setFullYear.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T3.js new file mode 100644 index 0000000000..707623ba51 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/S15.9.5.40_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setfullyear +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setFullYear.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setFullYear.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setFullYear) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js new file mode 100644 index 0000000000..33e6e9b366 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number-err.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Abrupt completion during type coercion of provided "date" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setFullYear(0, 0, obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js new file mode 100644 index 0000000000..00773ce72b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-date-to-number.js @@ -0,0 +1,79 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Type coercion of provided "date" +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6, 7, 11, 36, 23, 2); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setFullYear(2016, 6, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 2, 11, 36, 23, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setFullYear(2016, 6, null); + +assert.sameValue( + returnValue, + new Date(2016, 6, 0, 11, 36, 23, 2).getTime(), + 'null' +); + +returnValue = date.setFullYear(2016, 6, true); + +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 11, 36, 23, 2).getTime(), + 'true' +); + +returnValue = date.setFullYear(2016, 6, false); + +assert.sameValue( + returnValue, + new Date(2016, 6, 0, 11, 36, 23, 2).getTime(), + 'false' +); + +returnValue = date.setFullYear(2016, 6, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, + new Date(2016, 6, 2, 11, 36, 23, 2).getTime(), + 'string' +); + +returnValue = date.setFullYear(2016, 6, undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js new file mode 100644 index 0000000000..46bb7e8597 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number-err.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Abrupt completion during type coercion of provided "month" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setFullYear(0, obj, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js new file mode 100644 index 0000000000..500ad370fd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-month-to-number.js @@ -0,0 +1,79 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Type coercion of provided "month" +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6, 7, 11, 36, 23, 2); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setFullYear(2016, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 2, 7, 11, 36, 23, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setFullYear(2016, null); + +assert.sameValue( + returnValue, + new Date(2016, 0, 7, 11, 36, 23, 2).getTime(), + 'null' +); + +returnValue = date.setFullYear(2016, true); + +assert.sameValue( + returnValue, + new Date(2016, 1, 7, 11, 36, 23, 2).getTime(), + 'true' +); + +returnValue = date.setFullYear(2016, false); + +assert.sameValue( + returnValue, + new Date(2016, 0, 7, 11, 36, 23, 2).getTime(), + 'false' +); + +returnValue = date.setFullYear(2016, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, + new Date(2016, 2, 7, 11, 36, 23, 2).getTime(), + 'string' +); + +returnValue = date.setFullYear(2016, undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js new file mode 100644 index 0000000000..a8ec29c120 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number-err.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Abrupt completion during type coercion of provided "year" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setFullYear(obj, counter, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js new file mode 100644 index 0000000000..aa8481972f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/arg-year-to-number.js @@ -0,0 +1,79 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Type coercion of provided "year" +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6, 7, 11, 36, 23, 2); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setFullYear(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(-1, 42, 7, 11, 36, 23, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setFullYear(null); + +assert.sameValue( + returnValue, + new Date(-1, 18, 7, 11, 36, 23, 2).getTime(), + 'null' +); + +returnValue = date.setFullYear(true); + +assert.sameValue( + returnValue, + new Date(-1, 30, 7, 11, 36, 23, 2).getTime(), + 'true' +); + +returnValue = date.setFullYear(false); + +assert.sameValue( + returnValue, + new Date(-1, 18, 7, 11, 36, 23, 2).getTime(), + 'false' +); + +returnValue = date.setFullYear(' +00200.000E-0002 '); + +assert.sameValue( + returnValue, + new Date(-1, 42, 7, 11, 36, 23, 2).getTime(), + 'string' +); + +returnValue = date.setFullYear(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js new file mode 100644 index 0000000000..07255899ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setfullyear +description: > + Date.prototype.setFullYear.name is "setFullYear". +info: | + Date.prototype.setFullYear ( year [ , month [ , date ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setFullYear.name, "setFullYear"); + +verifyNotEnumerable(Date.prototype.setFullYear, "name"); +verifyNotWritable(Date.prototype.setFullYear, "name"); +verifyConfigurable(Date.prototype.setFullYear, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js new file mode 100644 index 0000000000..87db6a917d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/new-value-time-clip.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var maxMs = 8.64e15; +var maxYear = 275760; +var maxDate = 12; +var maxMonth = 8; +var date = new Date(maxMs); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setFullYear(maxYear + 1); + +assert.sameValue(returnValue, NaN, 'overflow due to year'); + +date = new Date(maxMs); + +returnValue = date.setFullYear(maxYear, maxMonth + 1); + +assert.sameValue(returnValue, NaN, 'overflow due to month'); + +date = new Date(maxMs); + +returnValue = date.setFullYear(maxYear, maxMonth, maxDate + 2); + +assert.sameValue(returnValue, NaN, 'overflow due to date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js new file mode 100644 index 0000000000..99b1f387c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setFullYear does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setFullYear), + false, + 'isConstructor(Date.prototype.setFullYear) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setFullYear(); +}, '`let date = new Date(Date.now()); new date.setFullYear()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js new file mode 100644 index 0000000000..11b2839acd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-invalid-date.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(NaN); +var expected, result; + +result = date.setFullYear(2016); + +expected = new Date(2016, 0).getTime(); +assert.sameValue(result, expected, 'return value (year)'); +assert.sameValue( + date.getTime(), expected, '[[DateValue]] internal slot (year)' +); + +date = new Date(NaN); + +result = date.setFullYear(2016, 6); + +expected = new Date(2016, 6).getTime(); +assert.sameValue(result, expected, 'return value (month)'); +assert.sameValue( + date.getTime(), expected, '[[DateValue]] internal slot (month)' +); + +date = new Date(NaN); + +result = date.setFullYear(2016, 6, 7); + +expected = new Date(2016, 6, 7).getTime(); +assert.sameValue(result, expected, 'return value (date)'); +assert.sameValue( + date.getTime(), expected, '[[DateValue]] internal slot (month)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js new file mode 100644 index 0000000000..e7d7d9eaee --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setFullYear = Date.prototype.setFullYear; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setFullYear, 'function'); + +assert.throws(TypeError, function() { + setFullYear.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setFullYear.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setFullYear.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js new file mode 100644 index 0000000000..d6646d55d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setFullYear = Date.prototype.setFullYear; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setFullYear, 'function'); + +assert.throws(TypeError, function() { + setFullYear.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setFullYear.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setFullYear.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setFullYear.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setFullYear.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setFullYear.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js new file mode 100644 index 0000000000..a11967b4f0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-date.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Return value for valid dates (setting date) +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setFullYear(2016, 6, 6); + +expected = new Date(2016, 6, 6).getTime(); +assert.sameValue( + returnValue, expected, 'date within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'date within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setFullYear(2016, 6, 0); + +expected = new Date(2016, 5, 30).getTime(); +assert.sameValue( + returnValue, expected, 'date before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'date before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setFullYear(2016, 5, 31); + +expected = new Date(2016, 6, 1).getTime(); +assert.sameValue( + returnValue, expected, 'date after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'date after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js new file mode 100644 index 0000000000..29248c387a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-month.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Return value for valid dates (setting month) +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setFullYear(2016, 3); + +expected = new Date(2016, 3).getTime(); +assert.sameValue( + returnValue, expected, 'month within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'month within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setFullYear(2016, -1); + +expected = new Date(2015, 11).getTime(); +assert.sameValue( + returnValue, expected, 'month before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'month before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setFullYear(2016, 12); + +expected = new Date(2017, 0).getTime(); +assert.sameValue( + returnValue, expected, 'month after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'month after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js new file mode 100644 index 0000000000..bd63580906 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setFullYear/this-value-valid-date-year.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setfullyear +description: Return value for valid dates (setting year) +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setFullYear(2015); + +expected = new Date(2015, 6).getTime(); +assert.sameValue(returnValue, expected, 'year (return value)'); +assert.sameValue(date.getTime(), expected, 'year ([[DateValue]] slot)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T1.js new file mode 100644 index 0000000000..522a7a554a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setHours" has { DontEnum } attributes +esid: sec-date.prototype.sethours +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setHours; +if (x === 1) { + Date.prototype.setHours = 2; +} else { + Date.prototype.setHours = 1; +} + +assert.notSameValue( + Date.prototype.setHours, + x, + 'The value of Date.prototype.setHours is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T2.js new file mode 100644 index 0000000000..6cf45d93cd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setHours" has { DontEnum } attributes +esid: sec-date.prototype.sethours +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.setHours, false, 'The value of delete Date.prototype.setHours is not false'); + +assert( + !Date.prototype.hasOwnProperty('setHours'), + 'The value of !Date.prototype.hasOwnProperty(\'setHours\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T3.js new file mode 100644 index 0000000000..7211067494 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setHours" has { DontEnum } attributes +esid: sec-date.prototype.sethours +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setHours'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setHours\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setHours", 'The value of x is not "setHours"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A2_T1.js new file mode 100644 index 0000000000..ccdabfa8fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setHours" is 4 +esid: sec-date.prototype.sethours +description: The "length" property of the "setHours" is 4 +---*/ +assert.sameValue( + Date.prototype.setHours.hasOwnProperty("length"), + true, + 'Date.prototype.setHours.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.setHours.length, 4, 'The value of Date.prototype.setHours.length is expected to be 4'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T1.js new file mode 100644 index 0000000000..9d5b7750df --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setHours property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.sethours +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setHours.length; +verifyNotWritable(Date.prototype.setHours, "length", null, 1); + +assert.sameValue( + Date.prototype.setHours.length, + x, + 'The value of Date.prototype.setHours.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T2.js new file mode 100644 index 0000000000..ac6a60cf7d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setHours property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.sethours +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setHours.length, + true, + 'The value of `delete Date.prototype.setHours.length` is expected to be true' +); + +assert( + !Date.prototype.setHours.hasOwnProperty('length'), + 'The value of !Date.prototype.setHours.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T3.js new file mode 100644 index 0000000000..5b7172510a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/S15.9.5.34_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setHours property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.sethours +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setHours.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setHours.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setHours) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-coercion-order.js new file mode 100644 index 0000000000..48bd259079 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-coercion-order.js @@ -0,0 +1,59 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Order of coercion of provided arguments vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let h be ? ToNumber(hour). + 3. If min is present, let m be ? ToNumber(min). + 4. If sec is present, let s be ? ToNumber(sec). + 5. If ms is present, let milli be ? ToNumber(ms). + 6. If t is NaN, return NaN. + 7. Set t to LocalTime(t). + 8. If min is not present, let m be MinFromTime(t). + 9. If sec is not present, let s be SecFromTime(t). + 10. If ms is not present, let milli be msFromTime(t). + 11. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 12. Let u be TimeClip(UTC(date)). + 13. Set the [[DateValue]] internal slot of this Date object to u. + 14. Return u. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argHour = { + valueOf: function() { + effects.push('valueOf hour'); + return 0; + } +}; +var argMin = { + valueOf: function() { + effects.push('valueOf min'); + return 0; + } +}; +var argSec = { + valueOf: function() { + effects.push('valueOf sec'); + return 0; + } +}; +var argMs = { + valueOf: function() { + effects.push('valueOf ms'); + return 0; + } +}; + +var returnValue = date.setHours(argHour, argMin, argSec, argMs); + +var expectedEffects = ['valueOf hour', 'valueOf min', 'valueOf sec', 'valueOf ms']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number-err.js new file mode 100644 index 0000000000..73dabb4639 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number-err.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Abrupt completion during type coercion of provided "hour" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(hour). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setHours(obj, counter, counter, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number.js new file mode 100644 index 0000000000..216be0e17c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-hour-to-number.js @@ -0,0 +1,64 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Type coercion of provided "hour" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setHours(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setHours(null); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0).getTime(), 'null'); + +returnValue = date.setHours(true); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 1).getTime(), 'true'); + +returnValue = date.setHours(false); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0).getTime(), 'false'); + +returnValue = date.setHours(' +00200.000E-0002 '); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 2).getTime(), 'string'); + +returnValue = date.setHours(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number-err.js new file mode 100644 index 0000000000..4182ad87d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number-err.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Abrupt completion during type coercion of provided "min" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setHours(0, obj, counter, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number.js new file mode 100644 index 0000000000..a8436d2555 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-min-to-number.js @@ -0,0 +1,64 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Type coercion of provided "min" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setHours(0, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setHours(0, null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setHours(0, true); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 1).getTime(), 'true'); + +returnValue = date.setHours(0, false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setHours(0, ' +00200.000E-0002 '); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 2).getTime(), 'string'); + +returnValue = date.setHours(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number-err.js new file mode 100644 index 0000000000..b8a62f59f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number-err.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Abrupt completion during type coercion of provided "ms" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setHours(0, 0, 0, obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number.js new file mode 100644 index 0000000000..8ea3112632 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-ms-to-number.js @@ -0,0 +1,68 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Type coercion of provided "ms" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setHours(0, 0, 0, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setHours(0, 0, 0, null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setHours(0, 0, 0, true); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 1).getTime(), 'true' +); + +returnValue = date.setHours(0, 0, 0, false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setHours(0, 0, 0, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setHours(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number-err.js new file mode 100644 index 0000000000..c0ba88235e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number-err.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Abrupt completion during type coercion of provided "sec" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setHours(0, 0, obj, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number.js new file mode 100644 index 0000000000..7171a1cb31 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/arg-sec-to-number.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Type coercion of provided "sec" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setHours(0, 0, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setHours(0, 0, null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setHours(0, 0, true); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 0, 1).getTime(), 'true'); + +returnValue = date.setHours(0, 0, false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setHours(0, 0, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setHours(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/name.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/name.js new file mode 100644 index 0000000000..9626594fc3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.sethours +description: > + Date.prototype.setHours.name is "setHours". +info: | + Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setHours.name, "setHours"); + +verifyNotEnumerable(Date.prototype.setHours, "name"); +verifyNotWritable(Date.prototype.setHours, "name"); +verifyConfigurable(Date.prototype.setHours, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/new-value-time-clip.js new file mode 100644 index 0000000000..2c08a9fb54 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/new-value-time-clip.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var maxMs = 8.64e15; +var date = new Date(maxMs); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setHours(24); + +assert.sameValue(returnValue, NaN, 'overflow due to hours'); + +date = new Date(maxMs); + +returnValue = date.setHours(0, 24 * 60); + +assert.sameValue(returnValue, NaN, 'overflow due to minutes'); + +date = new Date(maxMs); + +returnValue = date.setHours(0, 0, 24 * 60 * 60); + +assert.sameValue(returnValue, NaN, 'overflow due to seconds'); + +date = new Date(maxMs); + +returnValue = date.setHours(0, 0, 0, 24 * 60 * 60 * 1000); + +assert.sameValue(returnValue, NaN, 'overflow due to milliseconds'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/not-a-constructor.js new file mode 100644 index 0000000000..767fe264d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setHours does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setHours), + false, + 'isConstructor(Date.prototype.setHours) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setHours(); +}, '`let date = new Date(Date.now()); new date.setHours()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-invalid-date.js new file mode 100644 index 0000000000..d31e9479c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-invalid-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setHours(0); + +assert.sameValue(result, NaN, 'return value (hour)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (hour)'); + +result = date.setHours(0, 0); + +assert.sameValue(result, NaN, 'return value (minute)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (minute)'); + +result = date.setHours(0, 0, 0); + +assert.sameValue(result, NaN, 'return value (second)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (second)'); + +result = date.setHours(0, 0, 0, 0); + +assert.sameValue(result, NaN, 'return value (ms)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (ms)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-date.js new file mode 100644 index 0000000000..0112bd38ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setHours = Date.prototype.setHours; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setHours, 'function'); + +assert.throws(TypeError, function() { + setHours.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setHours.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setHours.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-object.js new file mode 100644 index 0000000000..6eee33d9cb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Behavior when "this" value is not an Object +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setHours = Date.prototype.setHours; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setHours, 'function'); + +assert.throws(TypeError, function() { + setHours.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setHours.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setHours.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setHours.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setHours.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setHours.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-hour.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-hour.js new file mode 100644 index 0000000000..da27e3a00b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-hour.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Return value for valid dates (setting hour) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setHours(6); + +expected = new Date(2016, 6, 1, 6).getTime(); +assert.sameValue( + returnValue, expected, 'hour within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'hour within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(-1); + +expected = new Date(2016, 5, 30, 23).getTime(); +assert.sameValue( + returnValue, expected, 'hour before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'hour before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(24); + +expected = new Date(2016, 6, 1).getTime(); +assert.sameValue( + returnValue, expected, 'hour after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'hour after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-min.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-min.js new file mode 100644 index 0000000000..9469513e35 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-min.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Return value for valid dates (setting min) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setHours(0, 23); + +expected = new Date(2016, 6, 1, 0, 23).getTime(); +assert.sameValue( + returnValue, expected, 'minute within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'minute within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(0, -1); + +expected = new Date(2016, 5, 30, 23, 59).getTime(); +assert.sameValue( + returnValue, expected, 'minute before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'minute before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(0, 60); + +expected = new Date(2016, 5, 30, 1).getTime(); +assert.sameValue( + returnValue, expected, 'minute after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'minute after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-ms.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-ms.js new file mode 100644 index 0000000000..00de558d9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-ms.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Return value for valid dates (setting ms) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setHours(0, 0, 0, 543); + +expected = new Date(2016, 6, 1, 0, 0, 0, 543).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(0, 0, 0, -1); + +expected = new Date(2016, 5, 30, 23, 59, 59, 999).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(0, 0, 0, 1000); + +expected = new Date(2016, 5, 30, 0, 0, 1).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-sec.js b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-sec.js new file mode 100644 index 0000000000..edfbe86f27 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setHours/this-value-valid-date-sec.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.sethours +description: Return value for valid dates (setting sec) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setHours(0, 0, 45); + +expected = new Date(2016, 6, 1, 0, 0, 45).getTime(); +assert.sameValue( + returnValue, expected, 'second within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'second within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(0, 0, -1); + +expected = new Date(2016, 5, 30, 23, 59, 59).getTime(); +assert.sameValue( + returnValue, expected, 'second before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'second before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setHours(0, 0, 60); + +expected = new Date(2016, 5, 30, 0, 1).getTime(); +assert.sameValue( + returnValue, expected, 'second after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'second after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T1.js new file mode 100644 index 0000000000..abd7ac57a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMilliseconds" has { DontEnum } attributes +esid: sec-date.prototype.setmilliseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setMilliseconds; +if (x === 1) { + Date.prototype.setMilliseconds = 2; +} else { + Date.prototype.setMilliseconds = 1; +} + +assert.notSameValue( + Date.prototype.setMilliseconds, + x, + 'The value of Date.prototype.setMilliseconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T2.js new file mode 100644 index 0000000000..3352f8071e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMilliseconds" has { DontEnum } attributes +esid: sec-date.prototype.setmilliseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setMilliseconds, + false, + 'The value of delete Date.prototype.setMilliseconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setMilliseconds'), + 'The value of !Date.prototype.hasOwnProperty(\'setMilliseconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T3.js new file mode 100644 index 0000000000..e058353e2a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMilliseconds" has { DontEnum } attributes +esid: sec-date.prototype.setmilliseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setMilliseconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setMilliseconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setMilliseconds", 'The value of x is not "setMilliseconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A2_T1.js new file mode 100644 index 0000000000..345a10bbd4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setMilliseconds" is 1 +esid: sec-date.prototype.setmilliseconds +description: The "length" property of the "setMilliseconds" is 1 +---*/ +assert.sameValue( + Date.prototype.setMilliseconds.hasOwnProperty("length"), + true, + 'Date.prototype.setMilliseconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setMilliseconds.length, + 1, + 'The value of Date.prototype.setMilliseconds.length is expected to be 1' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T1.js new file mode 100644 index 0000000000..f8f2f3478b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setmilliseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setMilliseconds.length; +verifyNotWritable(Date.prototype.setMilliseconds, "length", null, 1); + +assert.sameValue( + Date.prototype.setMilliseconds.length, + x, + 'The value of Date.prototype.setMilliseconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T2.js new file mode 100644 index 0000000000..fc4b43d39d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMilliseconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setmilliseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setMilliseconds.length, + true, + 'The value of `delete Date.prototype.setMilliseconds.length` is expected to be true' +); + +assert( + !Date.prototype.setMilliseconds.hasOwnProperty('length'), + 'The value of !Date.prototype.setMilliseconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T3.js new file mode 100644 index 0000000000..9e15b794be --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/S15.9.5.28_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setmilliseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setMilliseconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setMilliseconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setMilliseconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-coercion-order.js new file mode 100644 index 0000000000..38384ec1b1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-coercion-order.js @@ -0,0 +1,32 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Set ms to ? ToNumber(ms). + 3. If t is NaN, return NaN. + 4. Set t to LocalTime(t). + 5. Let time be MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms). + 6. Let u be TimeClip(UTC(MakeDate(Day(t), time))). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. +---*/ + +var date = new Date(NaN); +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 0; + } +}; + +var returnValue = date.setMilliseconds(arg); + +assert.sameValue(callCount, 1, 'ToNumber invoked exactly once'); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number-err.js new file mode 100644 index 0000000000..0875605156 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number-err.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: Abrupt completion during type coercion of provided argument +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setMilliseconds(obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number.js new file mode 100644 index 0000000000..9e9d0270bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/arg-to-number.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: Type coercion of provided argument +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setMilliseconds(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setMilliseconds(null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setMilliseconds(true); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 1).getTime(), 'true' +); + +returnValue = date.setMilliseconds(false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setMilliseconds(' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setMilliseconds(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/name.js new file mode 100644 index 0000000000..3430c5e216 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setmilliseconds +description: > + Date.prototype.setMilliseconds.name is "setMilliseconds". +info: | + Date.prototype.setMilliseconds ( ms ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setMilliseconds.name, "setMilliseconds"); + +verifyNotEnumerable(Date.prototype.setMilliseconds, "name"); +verifyNotWritable(Date.prototype.setMilliseconds, "name"); +verifyConfigurable(Date.prototype.setMilliseconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/new-value-time-clip.js new file mode 100644 index 0000000000..42a59468e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/new-value-time-clip.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var date = new Date(8.64e15); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setMilliseconds(1); + +assert.sameValue(returnValue, NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/not-a-constructor.js new file mode 100644 index 0000000000..3282e1a901 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setMilliseconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setMilliseconds), + false, + 'isConstructor(Date.prototype.setMilliseconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setMilliseconds(); +}, '`let date = new Date(Date.now()); new date.setMilliseconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-invalid-date.js new file mode 100644 index 0000000000..d0d4289699 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-invalid-date.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setMilliseconds(0); + +assert.sameValue(result, NaN, 'return value'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-date.js new file mode 100644 index 0000000000..6c6c2de96c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setMilliseconds = Date.prototype.setMilliseconds; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setMilliseconds, 'function'); + +assert.throws(TypeError, function() { + setMilliseconds.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setMilliseconds.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setMilliseconds.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-object.js new file mode 100644 index 0000000000..856d4cd3e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: Behavior when "this" value is not an Object +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setMilliseconds = Date.prototype.setMilliseconds; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setMilliseconds, 'function'); + +assert.throws(TypeError, function() { + setMilliseconds.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setMilliseconds.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setMilliseconds.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setMilliseconds.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setMilliseconds.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setMilliseconds.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-valid-date.js new file mode 100644 index 0000000000..4f1365abde --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMilliseconds/this-value-valid-date.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmilliseconds +description: Return value for valid dates +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setMilliseconds(333); + +expected = new Date(2016, 6, 1, 0, 0, 0, 333).getTime(); +assert.sameValue( + returnValue, expected, 'within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMilliseconds(-1); + +expected = new Date(2016, 5, 30, 23, 59, 59, 999).getTime(); +assert.sameValue( + returnValue, expected, 'before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMilliseconds(1000); + +expected = new Date(2016, 6, 1).getTime(); +assert.sameValue( + returnValue, expected, 'after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T1.js new file mode 100644 index 0000000000..495135965b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMinutes" has { DontEnum } attributes +esid: sec-date.prototype.setminutes +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setMinutes; +if (x === 1) { + Date.prototype.setMinutes = 2; +} else { + Date.prototype.setMinutes = 1; +} + +assert.notSameValue( + Date.prototype.setMinutes, + x, + 'The value of Date.prototype.setMinutes is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T2.js new file mode 100644 index 0000000000..3cc72be727 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMinutes" has { DontEnum } attributes +esid: sec-date.prototype.setminutes +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setMinutes, + false, + 'The value of delete Date.prototype.setMinutes is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setMinutes'), + 'The value of !Date.prototype.hasOwnProperty(\'setMinutes\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T3.js new file mode 100644 index 0000000000..61eba85e1a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMinutes" has { DontEnum } attributes +esid: sec-date.prototype.setminutes +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setMinutes'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setMinutes\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setMinutes", 'The value of x is not "setMinutes"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A2_T1.js new file mode 100644 index 0000000000..e95e992ab1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setMinutes" is 3 +esid: sec-date.prototype.setminutes +description: The "length" property of the "setMinutes" is 3 +---*/ +assert.sameValue( + Date.prototype.setMinutes.hasOwnProperty("length"), + true, + 'Date.prototype.setMinutes.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setMinutes.length, + 3, + 'The value of Date.prototype.setMinutes.length is expected to be 3' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T1.js new file mode 100644 index 0000000000..2224b138ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setminutes +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setMinutes.length; +verifyNotWritable(Date.prototype.setMinutes, "length", null, 1); + +assert.sameValue( + Date.prototype.setMinutes.length, + x, + 'The value of Date.prototype.setMinutes.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T2.js new file mode 100644 index 0000000000..d9a4a75086 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMinutes property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setminutes +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setMinutes.length, + true, + 'The value of `delete Date.prototype.setMinutes.length` is expected to be true' +); + +assert( + !Date.prototype.setMinutes.hasOwnProperty('length'), + 'The value of !Date.prototype.setMinutes.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T3.js new file mode 100644 index 0000000000..1380f4e35b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/S15.9.5.32_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setminutes +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setMinutes.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setMinutes.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setMinutes) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-coercion-order.js new file mode 100644 index 0000000000..50d81c114f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-coercion-order.js @@ -0,0 +1,51 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let m be ? ToNumber(min). + 3. If sec is present, let s be ? ToNumber(sec). + 4. If ms is present, let milli be ? ToNumber(ms). + 5. If t is NaN, return NaN. + 6. Set t to LocalTime(t). + 7. If sec is not present, let s be SecFromTime(t). + 8. If ms is not present, let milli be msFromTime(t). + 9. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)). + 10. Let u be TimeClip(UTC(date)). + 11. Set the [[DateValue]] internal slot of this Date object to u. + 12. Return u. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argMin = { + valueOf: function() { + effects.push('valueOf min'); + return 0; + } +}; +var argSec = { + valueOf: function() { + effects.push('valueOf sec'); + return 0; + } +}; +var argMs = { + valueOf: function() { + effects.push('valueOf ms'); + return 0; + } +}; + +var returnValue = date.setMinutes(argMin, argSec, argMs); + +var expectedEffects = ['valueOf min', 'valueOf sec', 'valueOf ms']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number-err.js new file mode 100644 index 0000000000..dbcee5ffbb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number-err.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Abrupt completion during type coercion of provided "min" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setMinutes(obj, counter, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number.js new file mode 100644 index 0000000000..18a9bb5809 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-min-to-number.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Type coercion of provided "min" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). + 3. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 4. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 5. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)). + 6. Let u be TimeClip(UTC(date)). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setMinutes(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setMinutes(null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setMinutes(true); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 1).getTime(), 'true'); + +returnValue = date.setMinutes(false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setMinutes(' +00200.000E-0002 '); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 2).getTime(), 'string'); + +returnValue = date.setMinutes(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number-err.js new file mode 100644 index 0000000000..f2036235e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number-err.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Abrupt completion during type coercion of provided "ms" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). + 3. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 4. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setMinutes(0, 0, obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number.js new file mode 100644 index 0000000000..84d4629baf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-ms-to-number.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Type coercion of provided "ms" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). + 3. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 4. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 5. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)). + 6. Let u be TimeClip(UTC(date)). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setMinutes(0, 0, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setMinutes(0, 0, null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setMinutes(0, 0, true); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 1).getTime(), 'true' +); + +returnValue = date.setMinutes(0, 0, false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setMinutes(0, 0, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setMinutes(0, 0, undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number-err.js new file mode 100644 index 0000000000..d57bba3b71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number-err.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Abrupt completion during type coercion of provided "sec" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). + 3. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setMinutes(0, 0, obj, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number.js new file mode 100644 index 0000000000..dbb11d823a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/arg-sec-to-number.js @@ -0,0 +1,64 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Type coercion of provided "sec" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). + 3. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 4. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 5. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)). + 6. Let u be TimeClip(UTC(date)). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setMinutes(0, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setMinutes(0, null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setMinutes(0, true); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 0, 1).getTime(), 'true'); + +returnValue = date.setMinutes(0, false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setMinutes(0, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setMinutes(0, undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/name.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/name.js new file mode 100644 index 0000000000..5b177e2027 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setminutes +description: > + Date.prototype.setMinutes.name is "setMinutes". +info: | + Date.prototype.setMinutes ( min [ , sec [ , ms ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setMinutes.name, "setMinutes"); + +verifyNotEnumerable(Date.prototype.setMinutes, "name"); +verifyNotWritable(Date.prototype.setMinutes, "name"); +verifyConfigurable(Date.prototype.setMinutes, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/new-value-time-clip.js new file mode 100644 index 0000000000..030a2b1998 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/new-value-time-clip.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(min). + 3. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 4. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 5. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)). + 6. Let u be TimeClip(UTC(date)). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var maxMs = 8.64e15; +var date = new Date(maxMs); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setMinutes(24 * 60); + +assert.sameValue(returnValue, NaN, 'overflow due to minutes'); + +date = new Date(maxMs); + +returnValue = date.setMinutes(0, 24 * 60 * 60); + +assert.sameValue(returnValue, NaN, 'overflow due to seconds'); + +date = new Date(maxMs); + +returnValue = date.setMinutes(0, 0, 24 * 60 * 60 * 1000); + +assert.sameValue(returnValue, NaN, 'overflow due to milliseconds'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/not-a-constructor.js new file mode 100644 index 0000000000..c65d687fb9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setMinutes does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setMinutes), + false, + 'isConstructor(Date.prototype.setMinutes) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setMinutes(); +}, '`let date = new Date(Date.now()); new date.setMinutes()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-invalid-date.js new file mode 100644 index 0000000000..625e53d8f9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-invalid-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let h be ? ToNumber(hour). + 3. If min is not specified, let m be MinFromTime(t); otherwise, let m be ? + ToNumber(min). + 4. If sec is not specified, let s be SecFromTime(t); otherwise, let s be ? + ToNumber(sec). + 5. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 6. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 7. Let u be TimeClip(UTC(date)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setMinutes(0); + +assert.sameValue(result, NaN, 'return value (hour)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (hour)'); + +result = date.setMinutes(0, 0); + +assert.sameValue(result, NaN, 'return value (minute)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (minute)'); + +result = date.setMinutes(0, 0, 0); + +assert.sameValue(result, NaN, 'return value (second)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (second)'); + +result = date.setMinutes(0, 0, 0, 0); + +assert.sameValue(result, NaN, 'return value (ms)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (ms)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-date.js new file mode 100644 index 0000000000..e6b5eff326 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setMinutes = Date.prototype.setMinutes; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setMinutes, 'function'); + +assert.throws(TypeError, function() { + setMinutes.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setMinutes.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setMinutes.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-object.js new file mode 100644 index 0000000000..4a2e9da81a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Behavior when "this" value is not an Object +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setMinutes = Date.prototype.setMinutes; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setMinutes, 'function'); + +assert.throws(TypeError, function() { + setMinutes.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setMinutes.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setMinutes.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setMinutes.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setMinutes.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setMinutes.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-valid-date.js new file mode 100644 index 0000000000..76b4f732d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMinutes/this-value-valid-date.js @@ -0,0 +1,131 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setminutes +description: Return value for valid dates +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6, 1); +var returnValue, expected; + +returnValue = date.setMinutes(23); + +expected = new Date(2016, 6, 1, 0, 23).getTime(); +assert.sameValue( + returnValue, expected, 'minute within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'minute within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMinutes(-1); + +expected = new Date(2016, 5, 30, 23, 59).getTime(); +assert.sameValue( + returnValue, expected, 'minute before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'minute before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMinutes(60); + +expected = new Date(2016, 6, 1).getTime(); +assert.sameValue( + returnValue, expected, 'minute after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'minute after time unit boundary ([[DateValue]] slot)' +); + +date = new Date(2016, 6, 1); + +returnValue = date.setMinutes(0, 45); + +expected = new Date(2016, 6, 1, 0, 0, 45).getTime(); +assert.sameValue( + returnValue, expected, 'second within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'second within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMinutes(0, -1); + +expected = new Date(2016, 5, 30, 23, 59, 59).getTime(); +assert.sameValue( + returnValue, expected, 'second before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'second before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMinutes(0, 60); + +expected = new Date(2016, 5, 30, 23, 1).getTime(); +assert.sameValue( + returnValue, expected, 'second after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'second after time unit boundary ([[DateValue]] slot)' +); + +date = new Date(2016, 6, 1); + +returnValue = date.setMinutes(0, 0, 345); + +expected = new Date(2016, 6, 1, 0, 0, 0, 345).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMinutes(0, 0, -1); + +expected = new Date(2016, 5, 30, 23, 59, 59, 999).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMinutes(0, 0, 1000); + +expected = new Date(2016, 5, 30, 23, 0, 1).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T1.js new file mode 100644 index 0000000000..ac3d594ccb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMonth" has { DontEnum } attributes +esid: sec-date.prototype.setmonth +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setMonth; +if (x === 1) { + Date.prototype.setMonth = 2; +} else { + Date.prototype.setMonth = 1; +} + +assert.notSameValue( + Date.prototype.setMonth, + x, + 'The value of Date.prototype.setMonth is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T2.js new file mode 100644 index 0000000000..492b1be5cd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMonth" has { DontEnum } attributes +esid: sec-date.prototype.setmonth +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.setMonth, false, 'The value of delete Date.prototype.setMonth is not false'); + +assert( + !Date.prototype.hasOwnProperty('setMonth'), + 'The value of !Date.prototype.hasOwnProperty(\'setMonth\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T3.js new file mode 100644 index 0000000000..22d2585a7c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setMonth" has { DontEnum } attributes +esid: sec-date.prototype.setmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setMonth'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setMonth\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setMonth", 'The value of x is not "setMonth"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A2_T1.js new file mode 100644 index 0000000000..ed5846befa --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setMonth" is 2 +esid: sec-date.prototype.setmonth +description: The "length" property of the "setMonth" is 2 +---*/ +assert.sameValue( + Date.prototype.setMonth.hasOwnProperty("length"), + true, + 'Date.prototype.setMonth.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.setMonth.length, 2, 'The value of Date.prototype.setMonth.length is expected to be 2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T1.js new file mode 100644 index 0000000000..f6c45f61ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMonth property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.setmonth +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setMonth.length; +verifyNotWritable(Date.prototype.setMonth, "length", null, 1); + +assert.sameValue( + Date.prototype.setMonth.length, + x, + 'The value of Date.prototype.setMonth.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T2.js new file mode 100644 index 0000000000..9238a8ed74 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMonth property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setmonth +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setMonth.length, + true, + 'The value of `delete Date.prototype.setMonth.length` is expected to be true' +); + +assert( + !Date.prototype.setMonth.hasOwnProperty('length'), + 'The value of !Date.prototype.setMonth.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T3.js new file mode 100644 index 0000000000..23f1888331 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/S15.9.5.38_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setMonth property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.setmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setMonth.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setMonth.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setMonth) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-coercion-order.js new file mode 100644 index 0000000000..a1bc3862af --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-coercion-order.js @@ -0,0 +1,43 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let m be ? ToNumber(month). + 3. If date is present, let dt be ? ToNumber(date). + 4. If t is NaN, return NaN. + 5. Set t to LocalTime(t). + 6. If date is not present, let dt be DateFromTime(t). + 7. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t)). + 8. Let u be TimeClip(UTC(newDate)). + 9. Set the [[DateValue]] internal slot of this Date object to u. + 10. Return u. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argMonth = { + valueOf: function() { + effects.push('valueOf month'); + return 0; + } +}; +var argDate = { + valueOf: function() { + effects.push('valueOf date'); + return 0; + } +}; + +var returnValue = date.setMonth(argMonth, argDate); + +var expectedEffects = ['valueOf month', 'valueOf date']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number-err.js new file mode 100644 index 0000000000..107b762d8e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number-err.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Abrupt completion during type coercion of provided "date" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(month). + 3. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setMonth(0, obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number.js new file mode 100644 index 0000000000..46db557fa8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-date-to-number.js @@ -0,0 +1,77 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Type coercion of provided "date" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(month). + 3. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 4. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), + TimeWithinDay(t)). + 5. Let u be TimeClip(UTC(newDate)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6, 7, 11, 36, 23, 2); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setMonth(6, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 2, 11, 36, 23, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setMonth(6, null); + +assert.sameValue( + returnValue, + new Date(2016, 6, 0, 11, 36, 23, 2).getTime(), + 'null' +); + +returnValue = date.setMonth(6, true); + +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 11, 36, 23, 2).getTime(), + 'true' +); + +returnValue = date.setMonth(6, false); + +assert.sameValue( + returnValue, + new Date(2016, 6, 0, 11, 36, 23, 2).getTime(), + 'false' +); + +returnValue = date.setMonth(6, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, + new Date(2016, 6, 2, 11, 36, 23, 2).getTime(), + 'string' +); + +returnValue = date.setMonth(6, undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number-err.js new file mode 100644 index 0000000000..e1ce3b4cc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number-err.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Abrupt completion during type coercion of provided "month" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setMonth(obj, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number.js new file mode 100644 index 0000000000..f1af4d13c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/arg-month-to-number.js @@ -0,0 +1,79 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Type coercion of provided "month" +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. +---*/ + +var date = new Date(2016, 6, 7, 11, 36, 23, 2); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setMonth(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 2, 7, 11, 36, 23, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setMonth(null); + +assert.sameValue( + returnValue, + new Date(2016, 0, 7, 11, 36, 23, 2).getTime(), + 'null' +); + +returnValue = date.setMonth(true); + +assert.sameValue( + returnValue, + new Date(2016, 1, 7, 11, 36, 23, 2).getTime(), + 'true' +); + +returnValue = date.setMonth(false); + +assert.sameValue( + returnValue, + new Date(2016, 0, 7, 11, 36, 23, 2).getTime(), + 'false' +); + +returnValue = date.setMonth(' +00200.000E-0002 '); + +assert.sameValue( + returnValue, + new Date(2016, 2, 7, 11, 36, 23, 2).getTime(), + 'string' +); + +returnValue = date.setMonth(undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/name.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/name.js new file mode 100644 index 0000000000..9e28f33557 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setmonth +description: > + Date.prototype.setMonth.name is "setMonth". +info: | + Date.prototype.setMonth ( month [ , date ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setMonth.name, "setMonth"); + +verifyNotEnumerable(Date.prototype.setMonth, "name"); +verifyNotWritable(Date.prototype.setMonth, "name"); +verifyConfigurable(Date.prototype.setMonth, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/new-value-time-clip.js new file mode 100644 index 0000000000..311f7e4ce6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/new-value-time-clip.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be ? thisTimeValue(this value). + 2. If t is NaN, let t be +0; otherwise, let t be LocalTime(t). + 3. Let y be ? ToNumber(year). + 4. If month is not specified, let m be MonthFromTime(t); otherwise, let m be + ? ToNumber(month). + 5. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 6. Let newDate be MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)). + 7. Let u be TimeClip(UTC(newDate)). + 8. Set the [[DateValue]] internal slot of this Date object to u. + 9. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var maxMs = 8.64e15; +var maxDate = 12; +var maxMonth = 8; +var date = new Date(maxMs); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setMonth(maxMonth + 1); + +assert.sameValue(returnValue, NaN, 'overflow due to month'); + +date = new Date(maxMs); + +returnValue = date.setMonth(maxMonth, maxDate + 2); + +assert.sameValue(returnValue, NaN, 'overflow due to date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/not-a-constructor.js new file mode 100644 index 0000000000..ce51b8a701 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setMonth does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setMonth), + false, + 'isConstructor(Date.prototype.setMonth) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setMonth(); +}, '`let date = new Date(Date.now()); new date.setMonth()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-invalid-date.js new file mode 100644 index 0000000000..d3e25b5e74 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-invalid-date.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(month). + 3. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 4. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), + TimeWithinDay(t)). + 5. Let u be TimeClip(UTC(newDate)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setMonth(6); + +assert.sameValue(result, NaN, 'return value (month)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (month)'); + +date = new Date(NaN); + +result = date.setMonth(6, 7); + +assert.sameValue(result, NaN, 'return value (date)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (month)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-date.js new file mode 100644 index 0000000000..4b57615917 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setMonth = Date.prototype.setMonth; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setMonth, 'function'); + +assert.throws(TypeError, function() { + setMonth.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setMonth.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setMonth.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-object.js new file mode 100644 index 0000000000..c43b784447 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Behavior when "this" value is not an Object +info: | + 1. Let t be ? thisTimeValue(this value). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setMonth = Date.prototype.setMonth; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setMonth, 'function'); + +assert.throws(TypeError, function() { + setMonth.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setMonth.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setMonth.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setMonth.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setMonth.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setMonth.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-date.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-date.js new file mode 100644 index 0000000000..ed06da40c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-date.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Return value for valid dates (setting date) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(month). + 3. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 4. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), + TimeWithinDay(t)). + 5. Let u be TimeClip(UTC(newDate)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setMonth(6, 6); + +expected = new Date(2016, 6, 6).getTime(); +assert.sameValue( + returnValue, expected, 'date within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'date within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMonth(6, 0); + +expected = new Date(2016, 5, 30).getTime(); +assert.sameValue( + returnValue, expected, 'date before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'date before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMonth(5, 31); + +expected = new Date(2016, 6, 1).getTime(); +assert.sameValue( + returnValue, expected, 'date after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'date after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-month.js b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-month.js new file mode 100644 index 0000000000..f4ba0fc61d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setMonth/this-value-valid-date-month.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setmonth +description: Return value for valid dates (setting month) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let m be ? ToNumber(month). + 3. If date is not specified, let dt be DateFromTime(t); otherwise, let dt be + ? ToNumber(date). + 4. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), + TimeWithinDay(t)). + 5. Let u be TimeClip(UTC(newDate)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setMonth(3); + +expected = new Date(2016, 3).getTime(); +assert.sameValue( + returnValue, expected, 'month within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'month within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMonth(-1); + +expected = new Date(2015, 11).getTime(); +assert.sameValue( + returnValue, expected, 'month before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'month before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setMonth(12); + +expected = new Date(2016, 0).getTime(); +assert.sameValue( + returnValue, expected, 'month after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'month after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T1.js new file mode 100644 index 0000000000..80cacf2f6a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setSeconds" has { DontEnum } attributes +esid: sec-date.prototype.setseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setSeconds; +if (x === 1) { + Date.prototype.setSeconds = 2; +} else { + Date.prototype.setSeconds = 1; +} + +assert.notSameValue( + Date.prototype.setSeconds, + x, + 'The value of Date.prototype.setSeconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T2.js new file mode 100644 index 0000000000..8d6c81ce9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setSeconds" has { DontEnum } attributes +esid: sec-date.prototype.setseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setSeconds, + false, + 'The value of delete Date.prototype.setSeconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setSeconds'), + 'The value of !Date.prototype.hasOwnProperty(\'setSeconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T3.js new file mode 100644 index 0000000000..0692617eb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setSeconds" has { DontEnum } attributes +esid: sec-date.prototype.setseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setSeconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setSeconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setSeconds", 'The value of x is not "setSeconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A2_T1.js new file mode 100644 index 0000000000..dcac968a56 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setSeconds" is 2 +esid: sec-date.prototype.setseconds +description: The "length" property of the "setSeconds" is 2 +---*/ +assert.sameValue( + Date.prototype.setSeconds.hasOwnProperty("length"), + true, + 'Date.prototype.setSeconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setSeconds.length, + 2, + 'The value of Date.prototype.setSeconds.length is expected to be 2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T1.js new file mode 100644 index 0000000000..5a240eca98 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setSeconds.length; +verifyNotWritable(Date.prototype.setSeconds, "length", null, 1); + +assert.sameValue( + Date.prototype.setSeconds.length, + x, + 'The value of Date.prototype.setSeconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T2.js new file mode 100644 index 0000000000..789bca4e48 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setSeconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setSeconds.length, + true, + 'The value of `delete Date.prototype.setSeconds.length` is expected to be true' +); + +assert( + !Date.prototype.setSeconds.hasOwnProperty('length'), + 'The value of !Date.prototype.setSeconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T3.js new file mode 100644 index 0000000000..80e814d9dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/S15.9.5.30_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setSeconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setSeconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setSeconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-coercion-order.js new file mode 100644 index 0000000000..1cbc4420c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-coercion-order.js @@ -0,0 +1,43 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Order of coercion of provided arguments vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let s be ? ToNumber(sec). + 3. If ms is present, let milli be ? ToNumber(ms). + 4. If t is NaN, return NaN. + 5. Set t to LocalTime(t). + 6. If ms is not present, let milli be msFromTime(t). + 7. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli)). + 8. Let u be TimeClip(UTC(date)). + 9. Set the [[DateValue]] internal slot of this Date object to u. + 10. Return u. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argSec = { + valueOf: function() { + effects.push('valueOf sec'); + return 0; + } +}; +var argMs = { + valueOf: function() { + effects.push('valueOf ms'); + return 0; + } +}; + +var returnValue = date.setSeconds(argSec, argMs); + +var expectedEffects = ['valueOf sec', 'valueOf ms']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number-err.js new file mode 100644 index 0000000000..abde04c4d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number-err.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Abrupt completion during type coercion of provided "ms" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setSeconds(0, obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number.js new file mode 100644 index 0000000000..daff2f09ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-ms-to-number.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Type coercion of provided "ms" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 4. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, + milli)). + 5. Let u be TimeClip(UTC(date)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setSeconds(0, arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setSeconds(0, null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setSeconds(0, true); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 1).getTime(), 'true' +); + +returnValue = date.setSeconds(0, false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setSeconds(0, ' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setSeconds(0, undefined); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number-err.js new file mode 100644 index 0000000000..c9dd0a499b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number-err.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Abrupt completion during type coercion of provided "sec" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). +---*/ + +var date = new Date(); +var callCount = 0; +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; +var counter = { + valueOf: function() { + callCount += 1; + } +}; + +assert.throws(Test262Error, function() { + date.setSeconds(obj, counter); +}); + +assert.sameValue(date.getTime(), originalValue); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number.js new file mode 100644 index 0000000000..c75b2ba52a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/arg-sec-to-number.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Type coercion of provided "sec" +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 4. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, + milli)). + 5. Let u be TimeClip(UTC(date)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setSeconds(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue( + returnValue, + new Date(2016, 6, 1, 0, 0, 2).getTime(), + 'application of specified value' +); + +returnValue = date.setSeconds(null); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'null'); + +returnValue = date.setSeconds(true); + +assert.sameValue(returnValue, new Date(2016, 6, 1, 0, 0, 1).getTime(), 'true'); + +returnValue = date.setSeconds(false); + +assert.sameValue(returnValue, new Date(2016, 6, 1).getTime(), 'false'); + +returnValue = date.setSeconds(' +00200.000E-0002 '); + +assert.sameValue( + returnValue, new Date(2016, 6, 1, 0, 0, 2).getTime(), 'string' +); + +returnValue = date.setSeconds(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/name.js new file mode 100644 index 0000000000..1850428386 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setseconds +description: > + Date.prototype.setSeconds.name is "setSeconds". +info: | + Date.prototype.setSeconds ( sec [ , ms ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setSeconds.name, "setSeconds"); + +verifyNotEnumerable(Date.prototype.setSeconds, "name"); +verifyNotWritable(Date.prototype.setSeconds, "name"); +verifyConfigurable(Date.prototype.setSeconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/new-value-time-clip.js new file mode 100644 index 0000000000..533ee21aa4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/new-value-time-clip.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 4. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, + milli)). + 5. Let u be TimeClip(UTC(date)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var maxMs = 8.64e15; +var date = new Date(maxMs); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setSeconds(24 * 60 * 60); + +assert.sameValue(returnValue, NaN, 'overflow due to seconds'); + +date = new Date(maxMs); + +returnValue = date.setSeconds(0, 24 * 60 * 60 * 1000); + +assert.sameValue(returnValue, NaN, 'overflow due to milliseconds'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/not-a-constructor.js new file mode 100644 index 0000000000..47cfa721dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setSeconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setSeconds), + false, + 'isConstructor(Date.prototype.setSeconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setSeconds(); +}, '`let date = new Date(Date.now()); new date.setSeconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-invalid-date.js new file mode 100644 index 0000000000..5c587952f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-invalid-date.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 4. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, + milli)). + 5. Let u be TimeClip(UTC(date)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setSeconds(0); + +assert.sameValue(result, NaN, 'return value (second)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (second)'); + +result = date.setSeconds(0, 0); + +assert.sameValue(result, NaN, 'return value (ms)'); +assert.sameValue(date.getTime(), NaN, '[[DateValue]] internal slot (ms)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-date.js new file mode 100644 index 0000000000..4905c669bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setSeconds = Date.prototype.setSeconds; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setSeconds, 'function'); + +assert.throws(TypeError, function() { + setSeconds.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setSeconds.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setSeconds.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-object.js new file mode 100644 index 0000000000..f977f32a26 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Behavior when "this" value is not an Object +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setSeconds = Date.prototype.setSeconds; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setSeconds, 'function'); + +assert.throws(TypeError, function() { + setSeconds.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setSeconds.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setSeconds.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setSeconds.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setSeconds.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setSeconds.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-ms.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-ms.js new file mode 100644 index 0000000000..9b1d89ff07 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-ms.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Return value for valid dates (setting ms) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 4. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, + milli)). + 5. Let u be TimeClip(UTC(date)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setSeconds(0, 543); + +expected = new Date(2016, 6, 1, 0, 0, 0, 543).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setSeconds(0, -1); + +expected = new Date(2016, 5, 30, 23, 59, 59, 999).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setSeconds(0, 1000); + +expected = new Date(2016, 5, 30, 23, 59, 1).getTime(); +assert.sameValue( + returnValue, expected, 'millisecond after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'millisecond after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-sec.js b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-sec.js new file mode 100644 index 0000000000..27075d0610 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setSeconds/this-value-valid-date-sec.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setseconds +description: Return value for valid dates (setting sec) +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let s be ? ToNumber(sec). + 3. If ms is not specified, let milli be msFromTime(t); otherwise, let milli + be ? ToNumber(ms). + 4. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, + milli)). + 5. Let u be TimeClip(UTC(date)). + 6. Set the [[DateValue]] internal slot of this Date object to u. + 7. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue, expected; + +returnValue = date.setSeconds(45); + +expected = new Date(2016, 6, 1, 0, 0, 45).getTime(); +assert.sameValue( + returnValue, expected, 'second within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), expected, 'second within unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setSeconds(-1); + +expected = new Date(2016, 5, 30, 23, 59, 59).getTime(); +assert.sameValue( + returnValue, expected, 'second before time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'second before time unit boundary ([[DateValue]] slot)' +); + +returnValue = date.setSeconds(60); + +expected = new Date(2016, 6).getTime(); +assert.sameValue( + returnValue, expected, 'second after time unit boundary (return value)' +); +assert.sameValue( + date.getTime(), + expected, + 'second after time unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T1.js new file mode 100644 index 0000000000..cdd891deac --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setTime" has { DontEnum } attributes +esid: sec-date.prototype.settime +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setTime; +if (x === 1) { + Date.prototype.setTime = 2; +} else { + Date.prototype.setTime = 1; +} + +assert.notSameValue( + Date.prototype.setTime, + x, + 'The value of Date.prototype.setTime is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T2.js new file mode 100644 index 0000000000..3d425994ab --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setTime" has { DontEnum } attributes +esid: sec-date.prototype.settime +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue(delete Date.prototype.setTime, false, 'The value of delete Date.prototype.setTime is not false'); + +assert( + !Date.prototype.hasOwnProperty('setTime'), + 'The value of !Date.prototype.hasOwnProperty(\'setTime\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T3.js new file mode 100644 index 0000000000..78164e813d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setTime" has { DontEnum } attributes +esid: sec-date.prototype.settime +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setTime'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setTime\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setTime", 'The value of x is not "setTime"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A2_T1.js new file mode 100644 index 0000000000..a4fa4209a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setTime" is 1 +esid: sec-date.prototype.settime +description: The "length" property of the "setTime" is 1 +---*/ +assert.sameValue( + Date.prototype.setTime.hasOwnProperty("length"), + true, + 'Date.prototype.setTime.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.setTime.length, 1, 'The value of Date.prototype.setTime.length is expected to be 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T1.js new file mode 100644 index 0000000000..4ef36f2f25 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setTime property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.settime +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setTime.length; +verifyNotWritable(Date.prototype.setTime, "length", null, 1); + +assert.sameValue( + Date.prototype.setTime.length, + x, + 'The value of Date.prototype.setTime.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T2.js new file mode 100644 index 0000000000..b66fe9c598 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setTime property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.settime +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setTime.length, + true, + 'The value of `delete Date.prototype.setTime.length` is expected to be true' +); + +assert( + !Date.prototype.setTime.hasOwnProperty('length'), + 'The value of !Date.prototype.setTime.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T3.js new file mode 100644 index 0000000000..9a6bd16d4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/S15.9.5.27_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setTime property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.settime +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setTime.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setTime.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setTime) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number-err.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number-err.js new file mode 100644 index 0000000000..4ce961f808 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number-err.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: Abrupt completion during type coercion of provided argument +info: | + 1. Perform ? thisTimeValue(this value). + 2. Let t be ? ToNumber(time). +---*/ + +var date = new Date(); +var originalValue = date.getTime(); +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + date.setTime(obj); +}); + +assert.sameValue(date.getTime(), originalValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number.js new file mode 100644 index 0000000000..daa2553131 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/arg-to-number.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: Type coercion of provided argument +info: | + 1. Perform ? thisTimeValue(this value). + 2. Let t be ? ToNumber(time). + 3. Let v be TimeClip(t). + 4. Set the [[DateValue]] internal slot of this Date object to v. + 5. Return v. +---*/ + +var date = new Date(2016, 6); +var callCount = 0; +var arg = { + valueOf: function() { + args = arguments; + thisValue = this; + callCount += 1; + return 2; + } +}; +var args, thisValue, returnValue; + +returnValue = date.setTime(arg); + +assert.sameValue(callCount, 1, 'invoked exactly once'); +assert.sameValue(args.length, 0, 'invoked without arguments'); +assert.sameValue(thisValue, arg, '"this" value'); +assert.sameValue(returnValue, 2, 'application of specified value'); + +returnValue = date.setTime(null); + +assert.sameValue(returnValue, 0, 'null'); + +returnValue = date.setTime(true); + +assert.sameValue(returnValue, 1, 'true'); + +returnValue = date.setTime(false); + +assert.sameValue(returnValue, 0, 'false'); + +returnValue = date.setTime(' +00200.000E-0002 '); + +assert.sameValue(returnValue, 2, 'string'); + +returnValue = date.setTime(); + +assert.sameValue(returnValue, NaN, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/name.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/name.js new file mode 100644 index 0000000000..b978b93ad5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.settime +description: > + Date.prototype.setTime.name is "setTime". +info: | + Date.prototype.setTime ( time ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setTime.name, "setTime"); + +verifyNotEnumerable(Date.prototype.setTime, "name"); +verifyNotWritable(Date.prototype.setTime, "name"); +verifyConfigurable(Date.prototype.setTime, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/new-value-time-clip.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/new-value-time-clip.js new file mode 100644 index 0000000000..8912795503 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/new-value-time-clip.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: Behavior when new value exceeds [[DateValue]] limits +info: | + 1. Perform ? thisTimeValue(this value). + 2. Let t be ? ToNumber(time). + 3. Let v be TimeClip(t). + 4. Set the [[DateValue]] internal slot of this Date object to v. + 5. Return v. + + TimeClip (time) + + 1. If time is not finite, return NaN. + 2. If abs(time) > 8.64 × 1015, return NaN. +---*/ + +var maxMs = 8.64e15; +var date = new Date(); +var returnValue; + +assert.notSameValue(date.getTime(), NaN); + +returnValue = date.setTime(maxMs + 1); + +assert.sameValue(returnValue, NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/not-a-constructor.js new file mode 100644 index 0000000000..5bd2d83907 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setTime does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setTime), + false, + 'isConstructor(Date.prototype.setTime) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setTime(); +}, '`let date = new Date(Date.now()); new date.setTime()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-invalid-date.js new file mode 100644 index 0000000000..d575d58231 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-invalid-date.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: > + Behavior when the "this" value is a Date object describing an invald date +info: | + 1. Perform ? thisTimeValue(this value). + 2. Let t be ? ToNumber(time). + 3. Let v be TimeClip(t). + 4. Set the [[DateValue]] internal slot of this Date object to v. + 5. Return v. +---*/ + +var date = new Date(NaN); +var result; + +result = date.setTime(0); + +assert.sameValue(result, 0, 'return value'); +assert.sameValue(date.getTime(), 0, '[[DateValue]] internal slot'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-date.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-date.js new file mode 100644 index 0000000000..6ecff8e82c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-date.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: > + Behavior when "this" value is an Object without a [[DateValue]] internal slot +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +---*/ + +var setTime = Date.prototype.setTime; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var args = (function() { + return arguments; +}()); + +assert.sameValue(typeof setTime, 'function'); + +assert.throws(TypeError, function() { + setTime.call({}, arg); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + setTime.call([], arg); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + setTime.call(args, arg); +}, 'arguments exotic object'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-object.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-object.js new file mode 100644 index 0000000000..c9eb97e3b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-non-object.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: Behavior when "this" value is not an Object +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + + The abstract operation thisTimeValue(value) performs the following steps: + + 1. If Type(value) is Object and value has a [[DateValue]] internal slot, then + a. Return value.[[DateValue]]. + 2. Throw a TypeError exception. +features: [Symbol] +---*/ + +var setTime = Date.prototype.setTime; +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 1; + } +}; +var symbol = Symbol(); + +assert.sameValue(typeof setTime, 'function'); + +assert.throws(TypeError, function() { + setTime.call(0, arg); +}, 'number'); + +assert.throws(TypeError, function() { + setTime.call(true, arg); +}, 'boolean'); + +assert.throws(TypeError, function() { + setTime.call(null, arg); +}, 'null'); + +assert.throws(TypeError, function() { + setTime.call(undefined, arg); +}, 'undefined'); + +assert.throws(TypeError, function() { + setTime.call('', arg); +}, 'string'); + +assert.throws(TypeError, function() { + setTime.call(symbol, arg); +}, 'symbol'); + +assert.sameValue(callCount, 0, 'validation precedes input coercion'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-valid-date.js b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-valid-date.js new file mode 100644 index 0000000000..e2cad61b51 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setTime/this-value-valid-date.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.settime +description: Return value for valid dates +info: | + 1. Let t be LocalTime(? thisTimeValue(this value)). + 2. Let dt be ? ToNumber(date). + 3. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), + TimeWithinDay(t)). + 4. Let u be TimeClip(UTC(newDate)). + 5. Set the [[DateValue]] internal slot of this Date object to u. + 6. Return u. +---*/ + +var date = new Date(2016, 6); +var returnValue; + +returnValue = date.setTime(6); + +assert.sameValue( + returnValue, 6, 'within unit boundary (return value)' +); +assert.sameValue( + date.getTime(), 6, 'within unit boundary ([[DateValue]] slot)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js new file mode 100644 index 0000000000..0ea8716125 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCDate; +if (x === 1) { + Date.prototype.setUTCDate = 2; +} else { + Date.prototype.setUTCDate = 1; +} + +assert.notSameValue( + Date.prototype.setUTCDate, + x, + 'The value of Date.prototype.setUTCDate is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js new file mode 100644 index 0000000000..84187b61d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCDate, + false, + 'The value of delete Date.prototype.setUTCDate is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCDate'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCDate\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js new file mode 100644 index 0000000000..e2085634a8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCDate" has { DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCDate'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCDate\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCDate", 'The value of x is not "setUTCDate"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js new file mode 100644 index 0000000000..0d7c6f5d11 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCDate" is 1 +esid: sec-date.prototype.setutcdate +description: The "length" property of the "setUTCDate" is 1 +---*/ +assert.sameValue( + Date.prototype.setUTCDate.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCDate.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCDate.length, + 1, + 'The value of Date.prototype.setUTCDate.length is expected to be 1' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js new file mode 100644 index 0000000000..4ec596966b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCDate property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCDate.length; +verifyNotWritable(Date.prototype.setUTCDate, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCDate.length, + x, + 'The value of Date.prototype.setUTCDate.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js new file mode 100644 index 0000000000..c171c07dc9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCDate property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCDate.length, + true, + 'The value of `delete Date.prototype.setUTCDate.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCDate.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCDate.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js new file mode 100644 index 0000000000..9e4fd50ded --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/S15.9.5.37_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCDate property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcdate +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCDate.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCDate.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCDate) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js new file mode 100644 index 0000000000..c00dcdd04c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/arg-coercion-order.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutcdate +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let dt be ? ToNumber(date). + 3. If t is NaN, return NaN. + 4. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t)). + 5. Let v be TimeClip(newDate). + 6. Set the [[DateValue]] internal slot of this Date object to v. + 7. Return v. +---*/ + +var date = new Date(NaN); +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 0; + } +}; + +var returnValue = date.setUTCDate(arg); + +assert.sameValue(callCount, 1, 'ToNumber invoked exactly once'); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js new file mode 100644 index 0000000000..4608a57892 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutcdate +description: > + Date.prototype.setUTCDate.name is "setUTCDate". +info: | + Date.prototype.setUTCDate ( date ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCDate.name, "setUTCDate"); + +verifyNotEnumerable(Date.prototype.setUTCDate, "name"); +verifyNotWritable(Date.prototype.setUTCDate, "name"); +verifyConfigurable(Date.prototype.setUTCDate, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js new file mode 100644 index 0000000000..eb0e04f08c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCDate does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCDate), + false, + 'isConstructor(Date.prototype.setUTCDate) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCDate(); +}, '`let date = new Date(Date.now()); new date.setUTCDate()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCDate/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T1.js new file mode 100644 index 0000000000..4bb9f2c245 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCFullYear" has { DontEnum } attributes +esid: sec-date.prototype.setutcfullyear +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCFullYear; +if (x === 1) { + Date.prototype.setUTCFullYear = 2; +} else { + Date.prototype.setUTCFullYear = 1; +} + +assert.notSameValue( + Date.prototype.setUTCFullYear, + x, + 'The value of Date.prototype.setUTCFullYear is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T2.js new file mode 100644 index 0000000000..1161ba431c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCFullYear" has { DontEnum } attributes +esid: sec-date.prototype.setutcfullyear +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCFullYear, + false, + 'The value of delete Date.prototype.setUTCFullYear is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCFullYear'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCFullYear\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T3.js new file mode 100644 index 0000000000..7362027367 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCFullYear" has { DontEnum } attributes +esid: sec-date.prototype.setutcfullyear +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCFullYear'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCFullYear\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCFullYear", 'The value of x is not "setUTCFullYear"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A2_T1.js new file mode 100644 index 0000000000..408605fcb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCFullYear" is 3 +esid: sec-date.prototype.setutcfullyear +description: The "length" property of the "setUTCFullYear" is 3 +---*/ +assert.sameValue( + Date.prototype.setUTCFullYear.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCFullYear.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCFullYear.length, + 3, + 'The value of Date.prototype.setUTCFullYear.length is expected to be 3' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T1.js new file mode 100644 index 0000000000..7015cef362 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcfullyear +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCFullYear.length; +verifyNotWritable(Date.prototype.setUTCFullYear, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCFullYear.length, + x, + 'The value of Date.prototype.setUTCFullYear.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T2.js new file mode 100644 index 0000000000..1076c90b23 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCFullYear property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcfullyear +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCFullYear.length, + true, + 'The value of `delete Date.prototype.setUTCFullYear.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCFullYear.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCFullYear.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T3.js new file mode 100644 index 0000000000..ece7db26db --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/S15.9.5.41_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCFullYear property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcfullyear +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCFullYear.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCFullYear.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCFullYear) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/name.js new file mode 100644 index 0000000000..3f0c1ce4ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutcfullyear +description: > + Date.prototype.setUTCFullYear.name is "setUTCFullYear". +info: | + Date.prototype.setUTCFullYear ( year [ , month [ , date ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCFullYear.name, "setUTCFullYear"); + +verifyNotEnumerable(Date.prototype.setUTCFullYear, "name"); +verifyNotWritable(Date.prototype.setUTCFullYear, "name"); +verifyConfigurable(Date.prototype.setUTCFullYear, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/not-a-constructor.js new file mode 100644 index 0000000000..06d291aa71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCFullYear does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCFullYear), + false, + 'isConstructor(Date.prototype.setUTCFullYear) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCFullYear(); +}, '`let date = new Date(Date.now()); new date.setUTCFullYear()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCFullYear/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T1.js new file mode 100644 index 0000000000..5bf8bdcc9b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCHours" has { DontEnum } attributes +esid: sec-date.prototype.setutchours +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCHours; +if (x === 1) { + Date.prototype.setUTCHours = 2; +} else { + Date.prototype.setUTCHours = 1; +} + +assert.notSameValue( + Date.prototype.setUTCHours, + x, + 'The value of Date.prototype.setUTCHours is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T2.js new file mode 100644 index 0000000000..487feb072a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCHours" has { DontEnum } attributes +esid: sec-date.prototype.setutchours +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCHours, + false, + 'The value of delete Date.prototype.setUTCHours is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCHours'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCHours\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T3.js new file mode 100644 index 0000000000..7be2011f65 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCHours" has { DontEnum } attributes +esid: sec-date.prototype.setutchours +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCHours'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCHours\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCHours", 'The value of x is not "setUTCHours"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A2_T1.js new file mode 100644 index 0000000000..ce429ce09e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCHours" is 4 +esid: sec-date.prototype.setutchours +description: The "length" property of the "setUTCHours" is 4 +---*/ +assert.sameValue( + Date.prototype.setUTCHours.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCHours.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCHours.length, + 4, + 'The value of Date.prototype.setUTCHours.length is expected to be 4' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T1.js new file mode 100644 index 0000000000..da911c82b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCHours property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutchours +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCHours.length; +verifyNotWritable(Date.prototype.setUTCHours, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCHours.length, + x, + 'The value of Date.prototype.setUTCHours.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T2.js new file mode 100644 index 0000000000..cad8d4c37a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCHours property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutchours +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCHours.length, + true, + 'The value of `delete Date.prototype.setUTCHours.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCHours.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCHours.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T3.js new file mode 100644 index 0000000000..d196adad9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/S15.9.5.35_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCHours property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutchours +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCHours.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCHours.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCHours) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/arg-coercion-order.js new file mode 100644 index 0000000000..bbb850e7cf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/arg-coercion-order.js @@ -0,0 +1,58 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutchours +description: Order of coercion of provided arguments vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let h be ? ToNumber(hour). + 3. If min is present, let m be ? ToNumber(min). + 4. If sec is present, let s be ? ToNumber(sec). + 5. If ms is present, let milli be ? ToNumber(ms). + 6. If t is NaN, return NaN. + 7. If min is not present, let m be MinFromTime(t). + 8. If sec is not present, let s be SecFromTime(t). + 9. If ms is not present, let milli be msFromTime(t). + 10. Let date be MakeDate(Day(t), MakeTime(h, m, s, milli)). + 11. Let v be TimeClip(date). + 12. Set the [[DateValue]] internal slot of this Date object to v. + 13. Return v. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argHour = { + valueOf: function() { + effects.push('valueOf hour'); + return 0; + } +}; +var argMin = { + valueOf: function() { + effects.push('valueOf min'); + return 0; + } +}; +var argSec = { + valueOf: function() { + effects.push('valueOf sec'); + return 0; + } +}; +var argMs = { + valueOf: function() { + effects.push('valueOf ms'); + return 0; + } +}; + +var returnValue = date.setUTCHours(argHour, argMin, argSec, argMs); + +var expectedEffects = ['valueOf hour', 'valueOf min', 'valueOf sec', 'valueOf ms']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/name.js new file mode 100644 index 0000000000..8335871c2c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutchours +description: > + Date.prototype.setUTCHours.name is "setUTCHours". +info: | + Date.prototype.setUTCHours ( hour [ , min [ , sec [ , ms ] ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCHours.name, "setUTCHours"); + +verifyNotEnumerable(Date.prototype.setUTCHours, "name"); +verifyNotWritable(Date.prototype.setUTCHours, "name"); +verifyConfigurable(Date.prototype.setUTCHours, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/not-a-constructor.js new file mode 100644 index 0000000000..a572e32b52 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCHours does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCHours), + false, + 'isConstructor(Date.prototype.setUTCHours) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCHours(); +}, '`let date = new Date(Date.now()); new date.setUTCHours()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCHours/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T1.js new file mode 100644 index 0000000000..a3770024c8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "setUTCMilliseconds" has { DontEnum } + attributes +esid: sec-date.prototype.setutcmilliseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCMilliseconds; +if (x === 1) { + Date.prototype.setUTCMilliseconds = 2; +} else { + Date.prototype.setUTCMilliseconds = 1; +} + +assert.notSameValue( + Date.prototype.setUTCMilliseconds, + x, + 'The value of Date.prototype.setUTCMilliseconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T2.js new file mode 100644 index 0000000000..a539610d4a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "setUTCMilliseconds" has { DontEnum } + attributes +esid: sec-date.prototype.setutcmilliseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCMilliseconds, + false, + 'The value of delete Date.prototype.setUTCMilliseconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCMilliseconds'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCMilliseconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T3.js new file mode 100644 index 0000000000..a7508f1b58 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "setUTCMilliseconds" has { DontEnum } + attributes +esid: sec-date.prototype.setutcmilliseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCMilliseconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCMilliseconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCMilliseconds", 'The value of x is not "setUTCMilliseconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A2_T1.js new file mode 100644 index 0000000000..dbaabc809e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCMilliseconds" is 1 +esid: sec-date.prototype.setutcmilliseconds +description: The "length" property of the "setUTCMilliseconds" is 1 +---*/ +assert.sameValue( + Date.prototype.setUTCMilliseconds.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCMilliseconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCMilliseconds.length, + 1, + 'The value of Date.prototype.setUTCMilliseconds.length is expected to be 1' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T1.js new file mode 100644 index 0000000000..6345c92b26 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcmilliseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCMilliseconds.length; +verifyNotWritable(Date.prototype.setUTCMilliseconds, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCMilliseconds.length, + x, + 'The value of Date.prototype.setUTCMilliseconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T2.js new file mode 100644 index 0000000000..7954d93fcd --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMilliseconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcmilliseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCMilliseconds.length, + true, + 'The value of `delete Date.prototype.setUTCMilliseconds.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCMilliseconds.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCMilliseconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T3.js new file mode 100644 index 0000000000..40071144d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/S15.9.5.29_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMilliseconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcmilliseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCMilliseconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCMilliseconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCMilliseconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/arg-coercion-order.js new file mode 100644 index 0000000000..02f2c3fd8a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/arg-coercion-order.js @@ -0,0 +1,32 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutcmilliseconds +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let dt be ? ToNumber(date). + 3. If t is NaN, return NaN. + 4. Set t to LocalTime(t). + 5. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t)). + 6. Let u be TimeClip(UTC(newDate)). + 7. Set the [[DateValue]] internal slot of this Date object to u. + 8. Return u. +---*/ + +var date = new Date(NaN); +var callCount = 0; +var arg = { + valueOf: function() { + callCount += 1; + return 0; + } +}; + +var returnValue = date.setUTCMilliseconds(arg); + +assert.sameValue(callCount, 1, 'ToNumber invoked exactly once'); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/name.js new file mode 100644 index 0000000000..65d0bd6f99 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutcmilliseconds +description: > + Date.prototype.setUTCMilliseconds.name is "setUTCMilliseconds". +info: | + Date.prototype.setUTCMilliseconds ( ms ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCMilliseconds.name, "setUTCMilliseconds"); + +verifyNotEnumerable(Date.prototype.setUTCMilliseconds, "name"); +verifyNotWritable(Date.prototype.setUTCMilliseconds, "name"); +verifyConfigurable(Date.prototype.setUTCMilliseconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/not-a-constructor.js new file mode 100644 index 0000000000..a7e4cbcc7b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCMilliseconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCMilliseconds), + false, + 'isConstructor(Date.prototype.setUTCMilliseconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCMilliseconds(); +}, '`let date = new Date(Date.now()); new date.setUTCMilliseconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMilliseconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T1.js new file mode 100644 index 0000000000..d2aa63596b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCMinutes" has { DontEnum } attributes +esid: sec-date.prototype.setutcminutes +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCMinutes; +if (x === 1) { + Date.prototype.setUTCMinutes = 2; +} else { + Date.prototype.setUTCMinutes = 1; +} + +assert.notSameValue( + Date.prototype.setUTCMinutes, + x, + 'The value of Date.prototype.setUTCMinutes is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T2.js new file mode 100644 index 0000000000..14f6fa9b8f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCMinutes" has { DontEnum } attributes +esid: sec-date.prototype.setutcminutes +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCMinutes, + false, + 'The value of delete Date.prototype.setUTCMinutes is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCMinutes'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCMinutes\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T3.js new file mode 100644 index 0000000000..0a3afc4f3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCMinutes" has { DontEnum } attributes +esid: sec-date.prototype.setutcminutes +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCMinutes'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCMinutes\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCMinutes", 'The value of x is not "setUTCMinutes"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A2_T1.js new file mode 100644 index 0000000000..62c01ca4b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCMinutes" is 3 +esid: sec-date.prototype.setutcminutes +description: The "length" property of the "setUTCMinutes" is 3 +---*/ +assert.sameValue( + Date.prototype.setUTCMinutes.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCMinutes.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCMinutes.length, + 3, + 'The value of Date.prototype.setUTCMinutes.length is expected to be 3' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T1.js new file mode 100644 index 0000000000..ca46350d6b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcminutes +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCMinutes.length; +verifyNotWritable(Date.prototype.setUTCMinutes, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCMinutes.length, + x, + 'The value of Date.prototype.setUTCMinutes.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T2.js new file mode 100644 index 0000000000..de0271b5b5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMinutes property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcminutes +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCMinutes.length, + true, + 'The value of `delete Date.prototype.setUTCMinutes.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCMinutes.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCMinutes.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T3.js new file mode 100644 index 0000000000..57301fe91f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/S15.9.5.33_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMinutes property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcminutes +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCMinutes.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCMinutes.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCMinutes) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/arg-coercion-order.js new file mode 100644 index 0000000000..83b0a0346d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/arg-coercion-order.js @@ -0,0 +1,50 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutcminutes +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let m be ? ToNumber(min). + 3. If sec is present, let s be ? ToNumber(sec). + 4. If ms is present, let milli be ? ToNumber(ms). + 5. If t is NaN, return NaN. + 6. If sec is not present, let s be SecFromTime(t). + 7. If ms is not present, let milli be msFromTime(t). + 8. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)). + 9. Let v be TimeClip(date). + 10. Set the [[DateValue]] internal slot of this Date object to v. + 11. Return v. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argMin = { + valueOf: function() { + effects.push('valueOf min'); + return 0; + } +}; +var argSec = { + valueOf: function() { + effects.push('valueOf sec'); + return 0; + } +}; +var argMs = { + valueOf: function() { + effects.push('valueOf ms'); + return 0; + } +}; + +var returnValue = date.setUTCMinutes(argMin, argSec, argMs); + +var expectedEffects = ['valueOf min', 'valueOf sec', 'valueOf ms']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/name.js new file mode 100644 index 0000000000..db16d42c80 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutcminutes +description: > + Date.prototype.setUTCMinutes.name is "setUTCMinutes". +info: | + Date.prototype.setUTCMinutes ( min [ , sec [, ms ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCMinutes.name, "setUTCMinutes"); + +verifyNotEnumerable(Date.prototype.setUTCMinutes, "name"); +verifyNotWritable(Date.prototype.setUTCMinutes, "name"); +verifyConfigurable(Date.prototype.setUTCMinutes, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/not-a-constructor.js new file mode 100644 index 0000000000..01f6a9293f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCMinutes does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCMinutes), + false, + 'isConstructor(Date.prototype.setUTCMinutes) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCMinutes(); +}, '`let date = new Date(Date.now()); new date.setUTCMinutes()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMinutes/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js new file mode 100644 index 0000000000..3a47d37da5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCMonth" has { DontEnum } attributes +esid: sec-date.prototype.setutcmonth +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCMonth; +if (x === 1) { + Date.prototype.setUTCMonth = 2; +} else { + Date.prototype.setUTCMonth = 1; +} + +assert.notSameValue( + Date.prototype.setUTCMonth, + x, + 'The value of Date.prototype.setUTCMonth is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js new file mode 100644 index 0000000000..e250febbfe --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCMonth" has { DontEnum } attributes +esid: sec-date.prototype.setutcmonth +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCMonth, + false, + 'The value of delete Date.prototype.setUTCMonth is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCMonth'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCMonth\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js new file mode 100644 index 0000000000..bf3154fab4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCMonth" has { DontEnum } attributes +esid: sec-date.prototype.setutcmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCMonth'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCMonth\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCMonth", 'The value of x is not "setUTCMonth"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js new file mode 100644 index 0000000000..e917ba9810 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCMonth" is 2 +esid: sec-date.prototype.setutcmonth +description: The "length" property of the "setUTCMonth" is 2 +---*/ +assert.sameValue( + Date.prototype.setUTCMonth.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCMonth.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCMonth.length, + 2, + 'The value of Date.prototype.setUTCMonth.length is expected to be 2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js new file mode 100644 index 0000000000..cf63985f95 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMonth property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcmonth +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCMonth.length; +verifyNotWritable(Date.prototype.setUTCMonth, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCMonth.length, + x, + 'The value of Date.prototype.setUTCMonth.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js new file mode 100644 index 0000000000..923cba2989 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMonth property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcmonth +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCMonth.length, + true, + 'The value of `delete Date.prototype.setUTCMonth.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCMonth.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCMonth.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js new file mode 100644 index 0000000000..03d107db9b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/S15.9.5.39_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCMonth property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcmonth +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCMonth.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCMonth.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCMonth) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js new file mode 100644 index 0000000000..c94d09f56d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js @@ -0,0 +1,42 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutcmonth +description: Order of coercion of provided argument vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let m be ? ToNumber(month). + 3. If date is present, let dt be ? ToNumber(date). + 4. If t is NaN, return NaN. + 5. If date is not present, let dt be DateFromTime(t). + 6. Let newDate be MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t)). + 7. Let v be TimeClip(newDate). + 8. Set the [[DateValue]] internal slot of this Date object to v. + 9. Return v. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argMonth = { + valueOf: function() { + effects.push('valueOf month'); + return 0; + } +}; +var argDate = { + valueOf: function() { + effects.push('valueOf date'); + return 0; + } +}; + +var returnValue = date.setUTCMonth(argMonth, argDate); + +var expectedEffects = ['valueOf month', 'valueOf date']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js new file mode 100644 index 0000000000..70ca8822ea --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutcmonth +description: > + Date.prototype.setUTCMonth.name is "setUTCMonth". +info: | + Date.prototype.setUTCMonth ( month [ , date ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCMonth.name, "setUTCMonth"); + +verifyNotEnumerable(Date.prototype.setUTCMonth, "name"); +verifyNotWritable(Date.prototype.setUTCMonth, "name"); +verifyConfigurable(Date.prototype.setUTCMonth, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js new file mode 100644 index 0000000000..977faba6d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCMonth does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCMonth), + false, + 'isConstructor(Date.prototype.setUTCMonth) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCMonth(); +}, '`let date = new Date(Date.now()); new date.setUTCMonth()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCMonth/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js new file mode 100644 index 0000000000..1d75241ef8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.setutcseconds +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.setUTCSeconds; +if (x === 1) { + Date.prototype.setUTCSeconds = 2; +} else { + Date.prototype.setUTCSeconds = 1; +} + +assert.notSameValue( + Date.prototype.setUTCSeconds, + x, + 'The value of Date.prototype.setUTCSeconds is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js new file mode 100644 index 0000000000..4a0cfaa0f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.setutcseconds +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.setUTCSeconds, + false, + 'The value of delete Date.prototype.setUTCSeconds is not false' +); + +assert( + !Date.prototype.hasOwnProperty('setUTCSeconds'), + 'The value of !Date.prototype.hasOwnProperty(\'setUTCSeconds\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js new file mode 100644 index 0000000000..efb81dd571 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "setUTCSeconds" has { DontEnum } attributes +esid: sec-date.prototype.setutcseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('setUTCSeconds'), + 'The value of !Date.prototype.propertyIsEnumerable(\'setUTCSeconds\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "setUTCSeconds", 'The value of x is not "setUTCSeconds"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js new file mode 100644 index 0000000000..314194b4c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "setUTCSeconds" is 2 +esid: sec-date.prototype.setutcseconds +description: The "length" property of the "setUTCSeconds" is 2 +---*/ +assert.sameValue( + Date.prototype.setUTCSeconds.hasOwnProperty("length"), + true, + 'Date.prototype.setUTCSeconds.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.setUTCSeconds.length, + 2, + 'The value of Date.prototype.setUTCSeconds.length is expected to be 2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js new file mode 100644 index 0000000000..422b8d2f54 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcseconds +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.setUTCSeconds.length; +verifyNotWritable(Date.prototype.setUTCSeconds, "length", null, 1); + +assert.sameValue( + Date.prototype.setUTCSeconds.length, + x, + 'The value of Date.prototype.setUTCSeconds.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js new file mode 100644 index 0000000000..195b848893 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCSeconds property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcseconds +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.setUTCSeconds.length, + true, + 'The value of `delete Date.prototype.setUTCSeconds.length` is expected to be true' +); + +assert( + !Date.prototype.setUTCSeconds.hasOwnProperty('length'), + 'The value of !Date.prototype.setUTCSeconds.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js new file mode 100644 index 0000000000..aec6f68e8d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/S15.9.5.31_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.setUTCSeconds property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.setutcseconds +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.setUTCSeconds.propertyIsEnumerable('length'), + 'The value of !Date.prototype.setUTCSeconds.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.setUTCSeconds) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js new file mode 100644 index 0000000000..a453b5a2c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js @@ -0,0 +1,42 @@ +// Copyright (C) 2021 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.setutcseconds +description: Order of coercion of provided arguments vs NaN check +info: | + 1. Let t be ? thisTimeValue(this value). + 2. Let s be ? ToNumber(sec). + 3. If ms is present, let milli be ? ToNumber(ms). + 4. If t is NaN, return NaN. + 5. If ms is not present, let milli be msFromTime(t). + 6. Let date be MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli)). + 7. Let v be TimeClip(date). + 8. Set the [[DateValue]] internal slot of this Date object to v. + 9. Return v. +includes: [compareArray.js] +---*/ + +var date = new Date(NaN); +var effects = []; +var argSec = { + valueOf: function() { + effects.push('valueOf sec'); + return 0; + } +}; +var argMs = { + valueOf: function() { + effects.push('valueOf ms'); + return 0; + } +}; + +var returnValue = date.setUTCSeconds(argSec, argMs); + +var expectedEffects = ['valueOf sec', 'valueOf ms']; + +assert.compareArray(effects, expectedEffects); +assert.sameValue(returnValue, NaN, 'argument is ignored when `this` is an invalid date'); +assert.sameValue(date.getTime(), NaN, 'argument is ignored when `this` is an invalid date'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js new file mode 100644 index 0000000000..b73874e84a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.setutcseconds +description: > + Date.prototype.setUTCSeconds.name is "setUTCSeconds". +info: | + Date.prototype.setUTCSeconds ( sec [ , ms ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.setUTCSeconds.name, "setUTCSeconds"); + +verifyNotEnumerable(Date.prototype.setUTCSeconds, "name"); +verifyNotWritable(Date.prototype.setUTCSeconds, "name"); +verifyConfigurable(Date.prototype.setUTCSeconds, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js new file mode 100644 index 0000000000..b6eebae507 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.setUTCSeconds does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.setUTCSeconds), + false, + 'isConstructor(Date.prototype.setUTCSeconds) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.setUTCSeconds(); +}, '`let date = new Date(Date.now()); new date.setUTCSeconds()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js b/js/src/tests/test262/built-ins/Date/prototype/setUTCSeconds/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/shell.js b/js/src/tests/test262/built-ins/Date/prototype/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T1.js new file mode 100644 index 0000000000..8c3b6275c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toDateString" has { DontEnum } attributes +esid: sec-date.prototype.todatestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toDateString; +if (x === 1) { + Date.prototype.toDateString = 2; +} else { + Date.prototype.toDateString = 1; +} + +assert.notSameValue( + Date.prototype.toDateString, + x, + 'The value of Date.prototype.toDateString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T2.js new file mode 100644 index 0000000000..b577a2dbc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toDateString" has { DontEnum } attributes +esid: sec-date.prototype.todatestring +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.toDateString, + false, + 'The value of delete Date.prototype.toDateString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toDateString'), + 'The value of !Date.prototype.hasOwnProperty(\'toDateString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T3.js new file mode 100644 index 0000000000..19fead51e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toDateString" has { DontEnum } attributes +esid: sec-date.prototype.todatestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toDateString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toDateString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toDateString", 'The value of x is not "toDateString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A2_T1.js new file mode 100644 index 0000000000..ec44678499 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "toDateString" is 0 +esid: sec-date.prototype.todatestring +description: The "length" property of the "toDateString" is 0 +---*/ +assert.sameValue( + Date.prototype.toDateString.hasOwnProperty("length"), + true, + 'Date.prototype.toDateString.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.toDateString.length, + 0, + 'The value of Date.prototype.toDateString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T1.js new file mode 100644 index 0000000000..ea918616ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toDateString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.todatestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toDateString.length; +verifyNotWritable(Date.prototype.toDateString, "length", null, 1); + +assert.sameValue( + Date.prototype.toDateString.length, + x, + 'The value of Date.prototype.toDateString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T2.js new file mode 100644 index 0000000000..d56ed18a20 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toDateString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.todatestring +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.toDateString.length, + true, + 'The value of `delete Date.prototype.toDateString.length` is expected to be true' +); + +assert( + !Date.prototype.toDateString.hasOwnProperty('length'), + 'The value of !Date.prototype.toDateString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T3.js new file mode 100644 index 0000000000..fd89a02806 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/S15.9.5.3_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toDateString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.todatestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toDateString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toDateString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toDateString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/format.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/format.js new file mode 100644 index 0000000000..3963baa981 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/format.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.todatestring +description: Test the format of the date from toDateString +info: | + Date.prototype.toDateString ( ) + + 5. Return DateString(_t_). +---*/ + +let dateRegExp = /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{2} [0-9]{4}$/ +let match = dateRegExp.exec(new Date().toDateString()); +assert.notSameValue(null, match); + +// Years are padded to the left with zeroes +match = dateRegExp.exec(new Date('0020-01-01T00:00:00Z').toDateString()); +assert.notSameValue(null, match); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/invalid-date.js new file mode 100644 index 0000000000..8a86c80abb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/invalid-date.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.todatestring +description: Invalid Dates are rendered as "Invalid Date" +info: | + Date.prototype.toDateString ( ) + + ... + 3. If tv is NaN, return "Invalid Date". + ... +---*/ + +assert.sameValue(new Date(NaN).toDateString(), "Invalid Date"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/name.js new file mode 100644 index 0000000000..3cd99649b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.todatestring +description: > + Date.prototype.toDateString.name is "toDateString". +info: | + Date.prototype.toDateString ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toDateString.name, "toDateString"); + +verifyNotEnumerable(Date.prototype.toDateString, "name"); +verifyNotWritable(Date.prototype.toDateString, "name"); +verifyConfigurable(Date.prototype.toDateString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/negative-year.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/negative-year.js new file mode 100644 index 0000000000..dfd228a582 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/negative-year.js @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Negative years must be serialized with at least four digits +esid: sec-date.prototype.todatestring +info: | + Date.prototype.toDateString ( ) + + 5. Return DateString(_t_). +---*/ + +var negative1DigitYearDateString = (new Date('-000001-07-01T00:00Z')).toDateString(); +var negative2DigitYearDateString = (new Date('-000012-07-01T00:00Z')).toDateString(); +var negative3DigitYearDateString = (new Date('-000123-07-01T00:00Z')).toDateString(); +var negative4DigitYearDateString = (new Date('-001234-07-01T00:00Z')).toDateString(); +var negative5DigitYearDateString = (new Date('-012345-07-01T00:00Z')).toDateString(); +var negative6DigitYearDateString = (new Date('-123456-07-01T00:00Z')).toDateString(); + +// Date.prototype.toDateString emits values like "Fri Mar 28 2019". +// Extract and verify just the year. +assert.sameValue(negative1DigitYearDateString.split(' ')[3], '-0001', + 'Date.prototype.toDateString serializes year -1 to "-0001"'); +assert.sameValue(negative2DigitYearDateString.split(' ')[3], '-0012', + 'Date.prototype.toDateString serializes year -12 to "-0012"'); +assert.sameValue(negative3DigitYearDateString.split(' ')[3], '-0123', + 'Date.prototype.toDateString serializes year -123 to "-0123"'); +assert.sameValue(negative4DigitYearDateString.split(' ')[3], '-1234', + 'Date.prototype.toDateString serializes year -1234 to "-1234"'); +assert.sameValue(negative5DigitYearDateString.split(' ')[3], '-12345', + 'Date.prototype.toDateString serializes year -12345 to "-12345"'); +assert.sameValue(negative6DigitYearDateString.split(' ')[3], '-123456', + 'Date.prototype.toDateString serializes year -123456 to "-123456"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/not-a-constructor.js new file mode 100644 index 0000000000..b70807dc68 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toDateString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toDateString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toDateString), + false, + 'isConstructor(Date.prototype.toDateString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toDateString(); +}, '`let date = new Date(Date.now()); new date.toDateString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toDateString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toDateString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js new file mode 100644 index 0000000000..44733d6b40 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, -99999999, 0, 0, 0, 1), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +if (timeZoneMinutes > 0) { + date = new Date(1970, 0, -99999999, 0, 0, 0, 1); + + assert.throws(RangeError, function() { + date.toISOString(); + }); +} else { + date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes + 60, 0, 1); + + dateStr = date.toISOString(); + + assert.sameValue(dateStr[dateStr.length - 1], "Z"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js new file mode 100644 index 0000000000..46cf645f0b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-11.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, 100000001, 0, 0, 0, -1), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +date = new Date(1970, 0, 100000001, 0, 0 + timeZoneMinutes - 60, 0, -1); +dateStr = date.toISOString(); + +assert.sameValue(dateStr[dateStr.length - 1], "Z", 'dateStr[dateStr.length - 1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js new file mode 100644 index 0000000000..68a07d2130 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-12.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, 100000001, 0, 0, 0, 0), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +date = new Date(1970, 0, 100000001, 0, 0 + timeZoneMinutes - 60, 0, 0); +dateStr = date.toISOString(); + +assert.sameValue(dateStr[dateStr.length - 1], "Z", 'dateStr[dateStr.length - 1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js new file mode 100644 index 0000000000..c2a7c4b128 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-13.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is thrown when value of + date is outside the valid range of time. +---*/ + +// As specified in ES5 15.9.1.14, time > 8.64e15 is not in the valid range. +var date = new Date(8.64e15 + 1); +assert.throws(RangeError, function() { + date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js new file mode 100644 index 0000000000..14e06ce204 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-14.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - when value of year is -Infinity + Date.prototype.toISOString throw the RangeError +---*/ + +var date = new Date(-Infinity, 1, 70, 0, 0, 0); +assert.throws(RangeError, function() { + date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js new file mode 100644 index 0000000000..2c35e8eb5f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-15.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - value of year is Infinity + Date.prototype.toISOString throw the RangeError +---*/ + +var date = new Date(Infinity, 1, 70, 0, 0, 0); +assert.throws(RangeError, function() { + date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js new file mode 100644 index 0000000000..57d3077101 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-16.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - when this is a String object that + value format is 'YYYY-MM-DDTHH:mm:ss.sssZ' + Date.prototype.toISOString throw the TypeError +---*/ + +var date = new String("1970-01-00000:00:00.000Z"); +assert.throws(TypeError, function() { + Date.prototype.toISOString.call(date); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js new file mode 100644 index 0000000000..796769d5eb --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-2.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString must exist as a function taking 0 + parameters +---*/ + +assert.sameValue(Date.prototype.toISOString.length, 0, 'Date.prototype.toISOString.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js new file mode 100644 index 0000000000..d14ec10718 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-3.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: Date.prototype.toISOString must exist as a function +---*/ + +assert.sameValue(typeof(Date.prototype.toISOString), "function", 'typeof (Date.prototype.toISOString)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js new file mode 100644 index 0000000000..14262310a7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-4.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - format of returned string is + 'YYYY-MM-DDTHH:mm:ss.sssZ', the time zone is UTC(0) +---*/ + +var date = new Date(1999, 9, 10, 10, 10, 10, 10); +var localDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000); + +assert.sameValue(localDate.toISOString(), "1999-10-10T10:10:10.010Z", 'localDate.toISOString()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js new file mode 100644 index 0000000000..e8aa9da25a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-5.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - The returned string is the UTC time + zone(0) +---*/ + +var dateStr = (new Date()).toISOString(); + +assert.sameValue(dateStr[dateStr.length - 1], "Z", 'dateStr[dateStr.length - 1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js new file mode 100644 index 0000000000..45a331da2d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-6.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - TypeError is thrown when this is any + other objects instead of Date object +---*/ + + +assert.throws(TypeError, function() { + Date.prototype.toISOString.call([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js new file mode 100644 index 0000000000..ca39dde06a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-7.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - TypeError is thrown when this is any + primitive values +---*/ + + +assert.throws(TypeError, function() { + Date.prototype.toISOString.call(15); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js new file mode 100644 index 0000000000..9ee9f39c9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-8.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is thrown when value of + date is Date(1970, 0, -99999999, 0, 0, 0, -1), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; +assert.throws(RangeError, function() { + if (timeZoneMinutes > 0) { + date = new Date(1970, 0, -99999999, 0, 0, 0, -1); + } else { + date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes - 60, 0, -1); + } + + dateStr = date.toISOString(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js new file mode 100644 index 0000000000..1dd2bd9875 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString - RangeError is not thrown when value + of date is Date(1970, 0, -99999999, 0, 0, 0, 0), the time zone is + UTC(0) +---*/ + +var timeZoneMinutes = new Date().getTimezoneOffset() * (-1); +var date, dateStr; + +if (timeZoneMinutes > 0) { + date = new Date(1970, 0, -99999999, 0, 0, 0, 0); + + assert.throws(RangeError, function() { + date.toISOString(); + }); +} else { + date = new Date(1970, 0, -99999999, 0, 0 + timeZoneMinutes + 60, 0, 0); + + dateStr = date.toISOString(); + + assert.sameValue(dateStr[dateStr.length - 1], "Z"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js new file mode 100644 index 0000000000..1abb089310 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toisostring +description: > + Date.prototype.toISOString.name is "toISOString". +info: | + Date.prototype.toISOString ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toISOString.name, "toISOString"); + +verifyNotEnumerable(Date.prototype.toISOString, "name"); +verifyNotWritable(Date.prototype.toISOString, "name"); +verifyConfigurable(Date.prototype.toISOString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js new file mode 100644 index 0000000000..a3dd9891ec --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toISOString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toISOString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toISOString), + false, + 'isConstructor(Date.prototype.toISOString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toISOString(); +}, '`let date = new Date(Date.now()); new date.toISOString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toISOString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toISOString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/builtin.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/builtin.js new file mode 100644 index 0000000000..cccb5c7e2e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/builtin.js @@ -0,0 +1,26 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + Tests that Date.prototype.toJSON meets the requirements + for built-in objects defined by the introduction of chapter 17 of + the ECMAScript Language Specification. +features: [Reflect.construct] +---*/ + +assert(Object.isExtensible(Date.prototype.toJSON), 'Object.isExtensible(Date.prototype.toJSON) must return true'); +assert.sameValue(typeof Date.prototype.toJSON, 'function', 'The value of `typeof Date.prototype.toJSON` is "function"'); +assert.sameValue( + Object.prototype.toString.call(Date.prototype.toJSON), + '[object Function]', + 'Object.prototype.toString.call(Date.prototype.toJSON) must return "[object Function]"' +); +assert.sameValue( + Object.getPrototypeOf(Date.prototype.toJSON), + Function.prototype, + 'Object.getPrototypeOf(Date.prototype.toJSON) must return the value of Function.prototype' +); +assert.sameValue(Date.prototype.toJSON.hasOwnProperty('prototype'), false, 'Date.prototype.toJSON.hasOwnProperty("prototype") must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/called-as-function.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/called-as-function.js new file mode 100644 index 0000000000..06e9775c6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/called-as-function.js @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tojson +description: > + `this` value is resolved using strict mode semantics, + throwing TypeError if called as top-level function. +info: | + Date.prototype.toJSON ( key ) + + 1. Let O be ? ToObject(this value). + + ToObject ( argument ) + + Argument Type: Undefined + Result: Throw a TypeError exception. +features: [Symbol, Symbol.toPrimitive] +---*/ + +[Symbol.toPrimitive, "toString", "valueOf", "toISOString"].forEach(function(key) { + Object.defineProperty(this, key, { + get: function() { + throw new Test262Error(String(key) + " lookup should not be performed"); + }, + }); +}, this); + +var toJSON = Date.prototype.toJSON; +assert.throws(TypeError, function() { + toJSON(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-abrupt.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-abrupt.js new file mode 100644 index 0000000000..0fba650fa8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-abrupt.js @@ -0,0 +1,40 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + Abrupt completion from GetV or Call. +info: | + Date.prototype.toJSON ( key ) + + [...] + 4. Return ? Invoke(O, "toISOString"). + + Invoke ( V, P [ , argumentsList ] ) + + [...] + 3. Let func be ? GetV(V, P). + 4. Return ? Call(func, V, argumentsList). +---*/ + +var abruptGet = { + get toISOString() { + throw new Test262Error(); + }, +}; + +assert.throws(Test262Error, function() { + Date.prototype.toJSON.call(abruptGet); +}); + +var abruptCall = { + toISOString() { + throw new Test262Error(); + }, +}; + +assert.throws(Test262Error, function() { + Date.prototype.toJSON.call(abruptCall); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-arguments.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-arguments.js new file mode 100644 index 0000000000..59638976cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-arguments.js @@ -0,0 +1,44 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + toISOString is called with correct context and without arguments. +info: | + Date.prototype.toJSON ( key ) + + [...] + 4. Return ? Invoke(O, "toISOString"). + + Invoke ( V, P [ , argumentsList ] ) + + [...] + 3. Let func be ? GetV(V, P). + 4. Return ? Call(func, V, argumentsList). +---*/ + +var getCount = 0, getContext; +var callCount = 0, callContext, callArguments; +var obj = { + get toISOString() { + getCount += 1; + getContext = this; + + return function() { + callCount += 1; + callContext = this; + callArguments = arguments; + }; + }, +}; + +Date.prototype.toJSON.call(obj); + +assert.sameValue(getCount, 1); +assert.sameValue(getContext, obj); + +assert.sameValue(callCount, 1); +assert.sameValue(callContext, obj); +assert.sameValue(callArguments.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-result.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-result.js new file mode 100644 index 0000000000..2f98510e64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/invoke-result.js @@ -0,0 +1,31 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + Result of toISOString call is returned. +info: | + Date.prototype.toJSON ( key ) + + [...] + 4. Return ? Invoke(O, "toISOString"). + + Invoke ( V, P [ , argumentsList ] ) + + [...] + 3. Let func be ? GetV(V, P). + 4. Return ? Call(func, V, argumentsList). +---*/ + +var date = new Date(); +assert.sameValue(date.toJSON(), date.toISOString()); + +var result = {}; +assert.sameValue( + Date.prototype.toJSON.call({ + toISOString: function() { return result; }, + }), + result +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/length.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/length.js new file mode 100644 index 0000000000..a4186d87dc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/length.js @@ -0,0 +1,25 @@ +// Copyright (C) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + Date.prototype.toJSON.length is 1. +info: | + Date.prototype.toJSON ( key ) + + ECMAScript Standard Built-in Objects + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +verifyProperty(Date.prototype.toJSON, 'length', { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/name.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/name.js new file mode 100644 index 0000000000..ca4abc27f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tojson +description: > + Date.prototype.toJSON.name is "toJSON". +info: | + Date.prototype.toJSON ( key ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +verifyProperty(Date.prototype.toJSON, 'name', { + value: 'toJSON', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/non-finite.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/non-finite.js new file mode 100644 index 0000000000..f3f6753a04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/non-finite.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + If this value coerces to non-finite number, null is returned. +info: | + Date.prototype.toJSON ( key ) + + [...] + 2. Let tv be ? ToPrimitive(O, hint Number). + 3. If Type(tv) is Number and tv is not finite, return null. +---*/ + +var toJSON = Date.prototype.toJSON; + +assert.sameValue( + toJSON.call({ + get toISOString() { throw new Test262Error(); }, + valueOf: function() { return NaN; }, + }), + null +); + +var num = new Number(-Infinity); +num.toISOString = function() { throw new Test262Error(); }; +assert.sameValue(toJSON.call(num), null); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/not-a-constructor.js new file mode 100644 index 0000000000..df5faff002 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toJSON does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toJSON), + false, + 'isConstructor(Date.prototype.toJSON) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toJSON(); +}, '`let date = new Date(Date.now()); new date.toJSON()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-object.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-object.js new file mode 100644 index 0000000000..579cc102a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-object.js @@ -0,0 +1,31 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + This value is coerced to an object. +info: | + Date.prototype.toJSON ( key ) + + 1. Let O be ? ToObject(this value). +features: [Symbol] +---*/ + +var toJSON = Date.prototype.toJSON; +this.toISOString = function() { return 'global'; }; + +assert.throws(TypeError, function() { + toJSON.call(undefined); +}); + +assert.throws(TypeError, function() { + toJSON.call(null); +}); + +Number.prototype.toISOString = function() { return 'str'; }; +assert.sameValue(toJSON.call(10), 'str'); + +Symbol.prototype.toISOString = function() { return 10; }; +assert.sameValue(toJSON.call(Symbol()), 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-abrupt.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-abrupt.js new file mode 100644 index 0000000000..767d8b8240 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-abrupt.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + Abrupt completion from ToPrimitive. +info: | + Date.prototype.toJSON ( key ) + + [...] + 2. Let tv be ? ToPrimitive(O, hint Number). + + ToPrimitive ( input [ , PreferredType ] ) + + 1. Assert: input is an ECMAScript language value. + 2. If Type(input) is Object, then + [...] + g. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive ( O, hint ) + + [...] + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ii. If Type(result) is not Object, return result. + 6. Throw a TypeError exception. +---*/ + +var toJSON = Date.prototype.toJSON; +var getAbrupt = { + get valueOf() { + throw new Test262Error(); + }, +}; + +assert.throws(Test262Error, function() { + toJSON.call(getAbrupt); +}); + +var callAbrupt = { + toString: function() { + throw new Test262Error(); + }, +}; + +assert.throws(Test262Error, function() { + toJSON.call(callAbrupt); +}); + +var notCoercible = Object.create(null); + +assert.throws(TypeError, function() { + toJSON.call(notCoercible); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-symbol.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-symbol.js new file mode 100644 index 0000000000..7cf18d9060 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-symbol.js @@ -0,0 +1,47 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + This value is coerced to primitive with Number hint (exotic @@toPrimitive). +info: | + Date.prototype.toJSON ( key ) + + [...] + 2. Let tv be ? ToPrimitive(O, hint Number). + + ToPrimitive ( input [ , PreferredType ] ) + + 1. Assert: input is an ECMAScript language value. + 2. If Type(input) is Object, then + [...] + d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + e. If exoticToPrim is not undefined, then + i. Let result be ? Call(exoticToPrim, input, « hint »). + ii. If Type(result) is not Object, return result. +features: [Symbol, Symbol.toPrimitive] +---*/ + +var callCount = 0, _this, _arguments; +var result = new Boolean(false); + +var obj = { + toISOString: function() { return result; }, + toString: function() { throw new Test262Error('should not be called'); }, + valueOf: function() { throw new Test262Error('should not be called'); }, +}; + +obj[Symbol.toPrimitive] = function() { + callCount += 1; + _this = this; + _arguments = arguments; + return 3.14; +}; + +assert.sameValue(Date.prototype.toJSON.call(obj), result); +assert.sameValue(callCount, 1); +assert.sameValue(_this, obj); +assert.sameValue(_arguments[0], 'number'); +assert.sameValue(_arguments.length, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-value-of.js b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-value-of.js new file mode 100644 index 0000000000..f8cf0c5f19 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toJSON/to-primitive-value-of.js @@ -0,0 +1,48 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-date.prototype.tojson +description: > + This value is coerced to primitive with Number hint (OrdinaryToPrimitive). +info: | + Date.prototype.toJSON ( key ) + + [...] + 2. Let tv be ? ToPrimitive(O, hint Number). + + ToPrimitive ( input [ , PreferredType ] ) + + 1. Assert: input is an ECMAScript language value. + 2. If Type(input) is Object, then + [...] + g. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive ( O, hint ) + + [...] + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ii. If Type(result) is not Object, return result. +---*/ + +var callCount = 0, _this, _arguments; +var result = []; +var obj = { + toISOString: function() { return result; }, + toString: function() { throw new Test262Error('should not be called'); }, + valueOf: function() { + callCount += 1; + _this = this; + _arguments = arguments; + return 'NaN'; + }, +}; + +assert.sameValue(Date.prototype.toJSON.call(obj), result); +assert.sameValue(callCount, 1); +assert.sameValue(_this, obj); +assert.sameValue(_arguments.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T1.js new file mode 100644 index 0000000000..4ecf0d3029 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "toLocaleDateString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaledatestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toLocaleDateString; +if (x === 1) { + Date.prototype.toLocaleDateString = 2; +} else { + Date.prototype.toLocaleDateString = 1; +} + +assert.notSameValue( + Date.prototype.toLocaleDateString, + x, + 'The value of Date.prototype.toLocaleDateString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T2.js new file mode 100644 index 0000000000..99ff7abca0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "toLocaleDateString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaledatestring +description: Checking absence of DontDelete attribute +---*/ +assert.notSameValue( + delete Date.prototype.toLocaleDateString, + false, + 'The value of delete Date.prototype.toLocaleDateString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toLocaleDateString'), + 'The value of !Date.prototype.hasOwnProperty(\'toLocaleDateString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T3.js new file mode 100644 index 0000000000..20a586e47f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "toLocaleDateString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaledatestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toLocaleDateString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toLocaleDateString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toLocaleDateString", 'The value of x is not "toLocaleDateString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A2_T1.js new file mode 100644 index 0000000000..283d863bf4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A2_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "toLocaleDateString" is 0 +esid: sec-date.prototype.tolocaledatestring +description: The "length" property of the "toLocaleDateString" is 0 +---*/ +assert.sameValue( + Date.prototype.toLocaleDateString.hasOwnProperty("length"), + true, + 'Date.prototype.toLocaleDateString.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.toLocaleDateString.length, + 0, + 'The value of Date.prototype.toLocaleDateString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T1.js new file mode 100644 index 0000000000..3df27ab673 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleDateString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaledatestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toLocaleDateString.length; +verifyNotWritable(Date.prototype.toLocaleDateString, "length", null, 1); + +assert.sameValue( + Date.prototype.toLocaleDateString.length, + x, + 'The value of Date.prototype.toLocaleDateString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T2.js new file mode 100644 index 0000000000..5339b513a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleDateString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaledatestring +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.toLocaleDateString.length, + true, + 'The value of `delete Date.prototype.toLocaleDateString.length` is expected to be true' +); + +assert( + !Date.prototype.toLocaleDateString.hasOwnProperty('length'), + 'The value of !Date.prototype.toLocaleDateString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T3.js new file mode 100644 index 0000000000..23f2fe919d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/S15.9.5.6_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleDateString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaledatestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toLocaleDateString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toLocaleDateString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toLocaleDateString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/name.js new file mode 100644 index 0000000000..0f3981a565 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tolocaledatestring +description: > + Date.prototype.toLocaleDateString.name is "toLocaleDateString". +info: | + Date.prototype.toLocaleDateString ( [ reserved1 [ , reserved2 ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toLocaleDateString.name, "toLocaleDateString"); + +verifyNotEnumerable(Date.prototype.toLocaleDateString, "name"); +verifyNotWritable(Date.prototype.toLocaleDateString, "name"); +verifyConfigurable(Date.prototype.toLocaleDateString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/not-a-constructor.js new file mode 100644 index 0000000000..45b56d70ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toLocaleDateString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toLocaleDateString), + false, + 'isConstructor(Date.prototype.toLocaleDateString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toLocaleDateString(); +}, '`let date = new Date(Date.now()); new date.toLocaleDateString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleDateString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T1.js new file mode 100644 index 0000000000..462d53f26b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toLocaleString" has { DontEnum } attributes +esid: sec-date.prototype.tolocalestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toLocaleString; +if (x === 1) { + Date.prototype.toLocaleString = 2; +} else { + Date.prototype.toLocaleString = 1; +} + +assert.notSameValue( + Date.prototype.toLocaleString, + x, + 'The value of Date.prototype.toLocaleString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T2.js new file mode 100644 index 0000000000..7048a1c8c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toLocaleString" has { DontEnum } attributes +esid: sec-date.prototype.tolocalestring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue( + delete Date.prototype.toLocaleString, + false, + 'The value of delete Date.prototype.toLocaleString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toLocaleString'), + 'The value of !Date.prototype.hasOwnProperty(\'toLocaleString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T3.js new file mode 100644 index 0000000000..8cd0d560cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toLocaleString" has { DontEnum } attributes +esid: sec-date.prototype.tolocalestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toLocaleString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toLocaleString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toLocaleString", 'The value of x is not "toLocaleString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A2_T1.js new file mode 100644 index 0000000000..a99ec98052 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "toLocaleString" is 0 +esid: sec-date.prototype.tolocalestring +description: The "length" property of the "toLocaleString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toLocaleString.hasOwnProperty("length"), + true, + 'Date.prototype.toLocaleString.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.toLocaleString.length, + 0, + 'The value of Date.prototype.toLocaleString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T1.js new file mode 100644 index 0000000000..4537937e8b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocalestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toLocaleString.length; +verifyNotWritable(Date.prototype.toLocaleString, "length", null, 1); + +assert.sameValue( + Date.prototype.toLocaleString.length, + x, + 'The value of Date.prototype.toLocaleString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T2.js new file mode 100644 index 0000000000..29166bae06 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocalestring +description: Checking DontDelete attribute +---*/ + +assert.sameValue( + delete Date.prototype.toLocaleString.length, + true, + 'The value of `delete Date.prototype.toLocaleString.length` is expected to be true' +); + +assert( + !Date.prototype.toLocaleString.hasOwnProperty('length'), + 'The value of !Date.prototype.toLocaleString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T3.js new file mode 100644 index 0000000000..af48b9388e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/S15.9.5.5_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocalestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toLocaleString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toLocaleString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toLocaleString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/name.js new file mode 100644 index 0000000000..1c2d1ad584 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tolocalestring +description: > + Date.prototype.toLocaleString.name is "toLocaleString". +info: | + Date.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toLocaleString.name, "toLocaleString"); + +verifyNotEnumerable(Date.prototype.toLocaleString, "name"); +verifyNotWritable(Date.prototype.toLocaleString, "name"); +verifyConfigurable(Date.prototype.toLocaleString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/not-a-constructor.js new file mode 100644 index 0000000000..4af86cd1e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toLocaleString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toLocaleString), + false, + 'isConstructor(Date.prototype.toLocaleString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toLocaleString(); +}, '`let date = new Date(Date.now()); new date.toLocaleString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js new file mode 100644 index 0000000000..21dd5d4411 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "toLocaleTimeString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toLocaleTimeString; +if (x === 1) { + Date.prototype.toLocaleTimeString = 2; +} else { + Date.prototype.toLocaleTimeString = 1; +} + +assert.notSameValue( + Date.prototype.toLocaleTimeString, + x, + 'The value of Date.prototype.toLocaleTimeString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T2.js new file mode 100644 index 0000000000..3069df6de6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "toLocaleTimeString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue( + delete Date.prototype.toLocaleTimeString, + false, + 'The value of delete Date.prototype.toLocaleTimeString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toLocaleTimeString'), + 'The value of !Date.prototype.hasOwnProperty(\'toLocaleTimeString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T3.js new file mode 100644 index 0000000000..ece77abd00 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype property "toLocaleTimeString" has { DontEnum } + attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toLocaleTimeString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toLocaleTimeString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toLocaleTimeString", 'The value of x is not "toLocaleTimeString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A2_T1.js new file mode 100644 index 0000000000..9db46eb034 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "toLocaleTimeString" is 0 +esid: sec-date.prototype.tolocaletimestring +description: The "length" property of the "toLocaleTimeString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toLocaleTimeString.hasOwnProperty("length"), + true, + 'Date.prototype.toLocaleTimeString.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.toLocaleTimeString.length, + 0, + 'The value of Date.prototype.toLocaleTimeString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T1.js new file mode 100644 index 0000000000..d0f4fbabc3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toLocaleTimeString.length; +verifyNotWritable(Date.prototype.toLocaleTimeString, "length", null, 1); + +assert.sameValue( + Date.prototype.toLocaleTimeString.length, + x, + 'The value of Date.prototype.toLocaleTimeString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T2.js new file mode 100644 index 0000000000..5137a41104 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleTimeString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking DontDelete attribute +---*/ + +assert.sameValue( + delete Date.prototype.toLocaleTimeString.length, + true, + 'The value of `delete Date.prototype.toLocaleTimeString.length` is expected to be true' +); + +assert( + !Date.prototype.toLocaleTimeString.hasOwnProperty('length'), + 'The value of !Date.prototype.toLocaleTimeString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T3.js new file mode 100644 index 0000000000..8e03eff9be --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/S15.9.5.7_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toLocaleTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tolocaletimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toLocaleTimeString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toLocaleTimeString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toLocaleTimeString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/name.js new file mode 100644 index 0000000000..260baf8b5d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tolocaletimestring +description: > + Date.prototype.toLocaleTimeString.name is "toLocaleTimeString". +info: | + Date.prototype.toLocaleTimeString ( [ reserved1 [ , reserved2 ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toLocaleTimeString.name, "toLocaleTimeString"); + +verifyNotEnumerable(Date.prototype.toLocaleTimeString, "name"); +verifyNotWritable(Date.prototype.toLocaleTimeString, "name"); +verifyConfigurable(Date.prototype.toLocaleTimeString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/not-a-constructor.js new file mode 100644 index 0000000000..6f648bb789 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toLocaleTimeString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toLocaleTimeString), + false, + 'isConstructor(Date.prototype.toLocaleTimeString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toLocaleTimeString(); +}, '`let date = new Date(Date.now()); new date.toLocaleTimeString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toLocaleTimeString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T1.js new file mode 100644 index 0000000000..6612e3a747 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toString" has { DontEnum } attributes +esid: sec-date.prototype.tostring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toString; +if (x === 1) { + Date.prototype.toString = 2; +} else { + Date.prototype.toString = 1; +} + +assert.notSameValue( + Date.prototype.toString, + x, + 'The value of Date.prototype.toString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T2.js new file mode 100644 index 0000000000..0395c2e111 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toString" has { DontEnum } attributes +esid: sec-date.prototype.tostring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue(delete Date.prototype.toString, false, 'The value of delete Date.prototype.toString is not false'); +assert( + !Date.prototype.hasOwnProperty('toString'), + 'The value of !Date.prototype.hasOwnProperty(\'toString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T3.js new file mode 100644 index 0000000000..494bbdb2ac --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toString" has { DontEnum } attributes +esid: sec-date.prototype.tostring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toString", 'The value of x is not "toString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A2_T1.js new file mode 100644 index 0000000000..6139039893 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A2_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "toString" is 0 +esid: sec-date.prototype.tostring +description: The "length" property of the "toString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toString.hasOwnProperty("length"), + true, + 'Date.prototype.toString.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.toString.length, 0, 'The value of Date.prototype.toString.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T1.js new file mode 100644 index 0000000000..f8505716f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toString property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.tostring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toString.length; +verifyNotWritable(Date.prototype.toString, "length", null, 1); + +assert.sameValue( + Date.prototype.toString.length, + x, + 'The value of Date.prototype.toString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T2.js new file mode 100644 index 0000000000..d265d9f4c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.tostring +description: Checking DontDelete attribute +---*/ + +assert.sameValue( + delete Date.prototype.toString.length, + true, + 'The value of `delete Date.prototype.toString.length` is expected to be true' +); + +assert( + !Date.prototype.toString.hasOwnProperty('length'), + 'The value of !Date.prototype.toString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T3.js new file mode 100644 index 0000000000..d4b54c6f79 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/S15.9.5.2_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toString property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.tostring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/format.js b/js/src/tests/test262/built-ins/Date/prototype/toString/format.js new file mode 100644 index 0000000000..70aa3efe27 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/format.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tostring +description: Test the format of the time from toString +info: | + Runtime Semantics: ToDateString( _tv_ ) + + 4. Return the String value formed by concatenating DateString(_t_), `" "`, TimeString(_t_), and TimeZoneString(_tv_). + +---*/ + +let stringRegExp = /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{2} [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} GMT[+-][0-9]{4}( \(.+\))?$/ +let match = stringRegExp.exec(new Date().toString()); +assert.notSameValue(null, match); + +// Years are padded to the left with zeroes +match = stringRegExp.exec(new Date('0020-01-01T00:00:00Z').toString()); +assert.notSameValue(null, match); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/toString/invalid-date.js new file mode 100644 index 0000000000..9d0373a571 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/invalid-date.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-todatestring +description: Invalid Dates are rendered as "Invalid Date" +info: | + ToDateString ( tv ) + + ... + 2. If tv is NaN, return "Invalid Date". + ... +---*/ + +assert.sameValue(new Date(NaN).toString(), "Invalid Date"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toString/name.js new file mode 100644 index 0000000000..9bfd383b55 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tostring +description: > + Date.prototype.toString.name is "toString". +info: | + Date.prototype.toString ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toString.name, "toString"); + +verifyNotEnumerable(Date.prototype.toString, "name"); +verifyNotWritable(Date.prototype.toString, "name"); +verifyConfigurable(Date.prototype.toString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/negative-year.js b/js/src/tests/test262/built-ins/Date/prototype/toString/negative-year.js new file mode 100644 index 0000000000..b1cd8d2d2c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/negative-year.js @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Negative years must be serialized with at least four digits +esid: sec-date.prototype.tostring +info: | + Date.prototype.toString ( ) + + 2. Return ToDateString(_tv_). +---*/ + +var negative1DigitYearToString = (new Date('-000001-07-01T00:00Z')).toString(); +var negative2DigitYearToString = (new Date('-000012-07-01T00:00Z')).toString(); +var negative3DigitYearToString = (new Date('-000123-07-01T00:00Z')).toString(); +var negative4DigitYearToString = (new Date('-001234-07-01T00:00Z')).toString(); +var negative5DigitYearToString = (new Date('-012345-07-01T00:00Z')).toString(); +var negative6DigitYearToString = (new Date('-123456-07-01T00:00Z')).toString(); + +// Date.prototype.toString emits values like +// "Fri Mar 28 2019 10:23:42 GMT-0400 (Eastern Daylight Time)". +// Extract and verify just the year. +assert.sameValue(negative1DigitYearToString.split(' ')[3], '-0001', + 'Date.prototype.toString serializes year -1 to "-0001"'); +assert.sameValue(negative2DigitYearToString.split(' ')[3], '-0012', + 'Date.prototype.toString serializes year -12 to "-0012"'); +assert.sameValue(negative3DigitYearToString.split(' ')[3], '-0123', + 'Date.prototype.toString serializes year -123 to "-0123"'); +assert.sameValue(negative4DigitYearToString.split(' ')[3], '-1234', + 'Date.prototype.toString serializes year -1234 to "-1234"'); +assert.sameValue(negative5DigitYearToString.split(' ')[3], '-12345', + 'Date.prototype.toString serializes year -12345 to "-12345"'); +assert.sameValue(negative6DigitYearToString.split(' ')[3], '-123456', + 'Date.prototype.toString serializes year -123456 to "-123456"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/non-date-receiver.js b/js/src/tests/test262/built-ins/Date/prototype/toString/non-date-receiver.js new file mode 100644 index 0000000000..02ce03a839 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/non-date-receiver.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.tostring +description: Date.prototype.toString throws a TypeError on non-Date receivers +info: | + Date.prototype.toString ( ) + + 1. Let tv be ? thisTimeValue(this value). +---*/ + +assert.throws(TypeError, () => Date.prototype.toString()); +assert.throws(TypeError, () => Date.prototype.toString.call(undefined)); +assert.throws(TypeError, () => Date.prototype.toString.call(0)); +assert.throws(TypeError, () => Date.prototype.toString.call({})); +assert.throws(TypeError, () => + Date.prototype.toString.call("Tue Mar 21 2017 12:16:43 GMT-0400 (EDT)")); +assert.throws(TypeError, () => + Date.prototype.toString.call(1490113011493)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toString/not-a-constructor.js new file mode 100644 index 0000000000..29da7f63b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toString), + false, + 'isConstructor(Date.prototype.toString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toString(); +}, '`let date = new Date(Date.now()); new date.toString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js new file mode 100644 index 0000000000..4b2913c51f --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toTimeString" has { DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toTimeString; +if (x === 1) { + Date.prototype.toTimeString = 2; +} else { + Date.prototype.toTimeString = 1; +} + +assert.notSameValue( + Date.prototype.toTimeString, + x, + 'The value of Date.prototype.toTimeString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.js new file mode 100644 index 0000000000..8a9830dd56 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toTimeString" has { DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue( + delete Date.prototype.toTimeString, + false, + 'The value of delete Date.prototype.toTimeString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toTimeString'), + 'The value of !Date.prototype.hasOwnProperty(\'toTimeString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js new file mode 100644 index 0000000000..c6a0aa0e02 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toTimeString" has { DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toTimeString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toTimeString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toTimeString", 'The value of x is not "toTimeString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js new file mode 100644 index 0000000000..2d8c9676f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: The "length" property of the "toTimeString" is 0 +esid: sec-date.prototype.totimestring +description: The "length" property of the "toTimeString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toTimeString.hasOwnProperty("length"), + true, + 'Date.prototype.toTimeString.hasOwnProperty("length") must return true' +); + + +assert.sameValue( + Date.prototype.toTimeString.length, + 0, + 'The value of Date.prototype.toTimeString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js new file mode 100644 index 0000000000..8337e86cbf --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toTimeString.length; +verifyNotWritable(Date.prototype.toTimeString, "length", null, 1); + +assert.sameValue( + Date.prototype.toTimeString.length, + x, + 'The value of Date.prototype.toTimeString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T2.js new file mode 100644 index 0000000000..27c8d06ee0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toTimeString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking DontDelete attribute +---*/ +assert.sameValue( + delete Date.prototype.toTimeString.length, + true, + 'The value of `delete Date.prototype.toTimeString.length` is expected to be true' +); + +assert( + !Date.prototype.toTimeString.hasOwnProperty('length'), + 'The value of !Date.prototype.toTimeString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T3.js new file mode 100644 index 0000000000..ef6033fcc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/S15.9.5.4_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toTimeString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.totimestring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toTimeString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toTimeString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toTimeString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js new file mode 100644 index 0000000000..a00923a27a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/format.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.totimestring +description: Test the format of the time from toTimeString +info: | + Date.prototype.toTimeString ( ) + + 5. Return the String value formed by concatenating TimeString(_t_) and TimeZoneString(_tv_). +---*/ + +let timeRegExp = /^[0-9]{2}:[0-9]{2}:[0-9]{2} GMT[+-][0-9]{4}( \(.+\))?$/ +let match = timeRegExp.exec(new Date().toTimeString()); +assert.notSameValue(null, match); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js new file mode 100644 index 0000000000..58e9ebd515 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/invalid-date.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.totimestring +description: Invalid Dates are rendered as "Invalid Date" +info: | + Date.prototype.toTimeString ( ) + + ... + 3. If tv is NaN, return "Invalid Date". + ... +---*/ + +assert.sameValue(new Date(NaN).toTimeString(), "Invalid Date"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js new file mode 100644 index 0000000000..4616efbad2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.totimestring +description: > + Date.prototype.toTimeString.name is "toTimeString". +info: | + Date.prototype.toTimeString ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toTimeString.name, "toTimeString"); + +verifyNotEnumerable(Date.prototype.toTimeString, "name"); +verifyNotWritable(Date.prototype.toTimeString, "name"); +verifyConfigurable(Date.prototype.toTimeString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js new file mode 100644 index 0000000000..7191049f7c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toTimeString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toTimeString), + false, + 'isConstructor(Date.prototype.toTimeString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toTimeString(); +}, '`let date = new Date(Date.now()); new date.toTimeString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toTimeString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toTimeString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T1.js new file mode 100644 index 0000000000..8112c69a00 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toUTCString" has { DontEnum } attributes +esid: sec-date.prototype.toutcstring +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.toUTCString; +if (x === 1) { + Date.prototype.toUTCString = 2; +} else { + Date.prototype.toUTCString = 1; +} + +assert.notSameValue( + Date.prototype.toUTCString, + x, + 'The value of Date.prototype.toUTCString is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T2.js new file mode 100644 index 0000000000..381863eb75 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toUTCString" has { DontEnum } attributes +esid: sec-date.prototype.toutcstring +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue( + delete Date.prototype.toUTCString, + false, + 'The value of delete Date.prototype.toUTCString is not false' +); + +assert( + !Date.prototype.hasOwnProperty('toUTCString'), + 'The value of !Date.prototype.hasOwnProperty(\'toUTCString\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T3.js new file mode 100644 index 0000000000..9f6547954c --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "toUTCString" has { DontEnum } attributes +esid: sec-date.prototype.toutcstring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('toUTCString'), + 'The value of !Date.prototype.propertyIsEnumerable(\'toUTCString\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "toUTCString", 'The value of x is not "toUTCString"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A2_T1.js new file mode 100644 index 0000000000..b7e15d69ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "toUTCString" is 0 +esid: sec-date.prototype.toutcstring +description: The "length" property of the "toUTCString" is 0 +---*/ + +assert.sameValue( + Date.prototype.toUTCString.hasOwnProperty("length"), + true, + 'Date.prototype.toUTCString.hasOwnProperty("length") must return true' +); + +assert.sameValue( + Date.prototype.toUTCString.length, + 0, + 'The value of Date.prototype.toUTCString.length is expected to be 0' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T1.js new file mode 100644 index 0000000000..37634bdfe6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toUTCString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.toutcstring +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.toUTCString.length; +verifyNotWritable(Date.prototype.toUTCString, "length", null, 1); + +assert.sameValue( + Date.prototype.toUTCString.length, + x, + 'The value of Date.prototype.toUTCString.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T2.js new file mode 100644 index 0000000000..23528c870d --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toUTCString property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.toutcstring +description: Checking DontDelete attribute +---*/ + +assert.sameValue( + delete Date.prototype.toUTCString.length, + true, + 'The value of `delete Date.prototype.toUTCString.length` is expected to be true' +); + +assert( + !Date.prototype.toUTCString.hasOwnProperty('length'), + 'The value of !Date.prototype.toUTCString.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T3.js new file mode 100644 index 0000000000..b15da4c994 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/S15.9.5.42_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.toUTCString property "length" has { ReadOnly, + DontDelete, DontEnum } attributes +esid: sec-date.prototype.toutcstring +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.toUTCString.propertyIsEnumerable('length'), + 'The value of !Date.prototype.toUTCString.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.toUTCString) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/browser.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/day-names.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/day-names.js new file mode 100644 index 0000000000..89af6499ab --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/day-names.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-todatestring-day-names +description: Test the names of days +---*/ + +assert.sameValue("Sun, 23 Mar 2014 00:00:00 GMT", + (new Date("2014-03-23T00:00:00Z")).toUTCString()); +assert.sameValue("Mon, 24 Mar 2014 00:00:00 GMT", + (new Date("2014-03-24T00:00:00Z")).toUTCString()); +assert.sameValue("Tue, 25 Mar 2014 00:00:00 GMT", + (new Date("2014-03-25T00:00:00Z")).toUTCString()); +assert.sameValue("Wed, 26 Mar 2014 00:00:00 GMT", + (new Date("2014-03-26T00:00:00Z")).toUTCString()); +assert.sameValue("Thu, 27 Mar 2014 00:00:00 GMT", + (new Date("2014-03-27T00:00:00Z")).toUTCString()); +assert.sameValue("Fri, 28 Mar 2014 00:00:00 GMT", + (new Date("2014-03-28T00:00:00Z")).toUTCString()); +assert.sameValue("Sat, 29 Mar 2014 00:00:00 GMT", + (new Date("2014-03-29T00:00:00Z")).toUTCString()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/format.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/format.js new file mode 100644 index 0000000000..54d3c07b1b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/format.js @@ -0,0 +1,20 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toutcstring +description: Test the format of the date from toUTCString +info: | + Date.prototype.toUTCString ( ) + + 4. Return the String value formed by concatenating DateString(_tv_, `", "`), `" "`, and TimeString(_tv_). +---*/ + +let utcRegExp = /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat), [0-9]{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} GMT$/ +let match = utcRegExp.exec(new Date().toUTCString()); +assert.notSameValue(null, match); + +// Years are padded to the left with zeroes +assert.sameValue('Wed, 01 Jan 0020 00:00:00 GMT', new Date('0020-01-01T00:00:00Z').toUTCString()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/invalid-date.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/invalid-date.js new file mode 100644 index 0000000000..8e2e433952 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/invalid-date.js @@ -0,0 +1,17 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toutcstring +description: Invalid Dates are rendered as "Invalid Date" +info: | + Date.prototype.toUTCString ( ) + + ... + 3. If tv is NaN, return "Invalid Date". + ... +---*/ + +assert.sameValue(new Date(NaN).toUTCString(), "Invalid Date"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/month-names.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/month-names.js new file mode 100644 index 0000000000..e6689d109a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/month-names.js @@ -0,0 +1,34 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-todatestring-month-names +description: Test the names of months +---*/ + +assert.sameValue("Wed, 01 Jan 2014 00:00:00 GMT", + (new Date("2014-01-01T00:00:00Z")).toUTCString()); +assert.sameValue("Sat, 01 Feb 2014 00:00:00 GMT", + (new Date("2014-02-01T00:00:00Z")).toUTCString()); +assert.sameValue("Sat, 01 Mar 2014 00:00:00 GMT", + (new Date("2014-03-01T00:00:00Z")).toUTCString()); +assert.sameValue("Tue, 01 Apr 2014 00:00:00 GMT", + (new Date("2014-04-01T00:00:00Z")).toUTCString()); +assert.sameValue("Thu, 01 May 2014 00:00:00 GMT", + (new Date("2014-05-01T00:00:00Z")).toUTCString()); +assert.sameValue("Sun, 01 Jun 2014 00:00:00 GMT", + (new Date("2014-06-01T00:00:00Z")).toUTCString()); +assert.sameValue("Tue, 01 Jul 2014 00:00:00 GMT", + (new Date("2014-07-01T00:00:00Z")).toUTCString()); +assert.sameValue("Fri, 01 Aug 2014 00:00:00 GMT", + (new Date("2014-08-01T00:00:00Z")).toUTCString()); +assert.sameValue("Mon, 01 Sep 2014 00:00:00 GMT", + (new Date("2014-09-01T00:00:00Z")).toUTCString()); +assert.sameValue("Wed, 01 Oct 2014 00:00:00 GMT", + (new Date("2014-10-01T00:00:00Z")).toUTCString()); +assert.sameValue("Sat, 01 Nov 2014 00:00:00 GMT", + (new Date("2014-11-01T00:00:00Z")).toUTCString()); +assert.sameValue("Mon, 01 Dec 2014 00:00:00 GMT", + (new Date("2014-12-01T00:00:00Z")).toUTCString()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/name.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/name.js new file mode 100644 index 0000000000..96fb0dce00 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.toutcstring +description: > + Date.prototype.toUTCString.name is "toUTCString". +info: | + Date.prototype.toUTCString ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.toUTCString.name, "toUTCString"); + +verifyNotEnumerable(Date.prototype.toUTCString, "name"); +verifyNotWritable(Date.prototype.toUTCString, "name"); +verifyConfigurable(Date.prototype.toUTCString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/negative-year.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/negative-year.js new file mode 100644 index 0000000000..a7bbcdf30a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/negative-year.js @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Negative years must be serialized with at least four digits +esid: sec-date.prototype.toutcstring +info: | + Date.prototype.toUTCString ( ) + + 10. Return the string-concatenation of _weekday_, `","`, the code unit 0x0020 (SPACE), _day_, the code unit 0x0020 (SPACE), _month_, the code unit 0x0020 (SPACE), _yearSign_, _year_, the code unit 0x0020 (SPACE), and TimeString(_tv_). +---*/ + +var negative1DigitYearToUTCString = (new Date('-000001-07-01T00:00Z')).toUTCString(); +var negative2DigitYearToUTCString = (new Date('-000012-07-01T00:00Z')).toUTCString(); +var negative3DigitYearToUTCString = (new Date('-000123-07-01T00:00Z')).toUTCString(); +var negative4DigitYearToUTCString = (new Date('-001234-07-01T00:00Z')).toUTCString(); +var negative5DigitYearToUTCString = (new Date('-012345-07-01T00:00Z')).toUTCString(); +var negative6DigitYearToUTCString = (new Date('-123456-07-01T00:00Z')).toUTCString(); + +// Date.prototype.toUTCString emits values like "Thu, 28 Mar 2019 10:23:42 GMT". +// Extract and verify just the year. +assert.sameValue(negative1DigitYearToUTCString.split(' ')[3], '-0001', + 'Date.prototype.toUTCString serializes year -1 to "-0001"'); +assert.sameValue(negative2DigitYearToUTCString.split(' ')[3], '-0012', + 'Date.prototype.toUTCString serializes year -12 to "-0012"'); +assert.sameValue(negative3DigitYearToUTCString.split(' ')[3], '-0123', + 'Date.prototype.toUTCString serializes year -123 to "-0123"'); +assert.sameValue(negative4DigitYearToUTCString.split(' ')[3], '-1234', + 'Date.prototype.toUTCString serializes year -1234 to "-1234"'); +assert.sameValue(negative5DigitYearToUTCString.split(' ')[3], '-12345', + 'Date.prototype.toUTCString serializes year -12345 to "-12345"'); +assert.sameValue(negative6DigitYearToUTCString.split(' ')[3], '-123456', + 'Date.prototype.toUTCString serializes year -123456 to "-123456"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/not-a-constructor.js new file mode 100644 index 0000000000..7c944cd036 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.toUTCString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.toUTCString), + false, + 'isConstructor(Date.prototype.toUTCString) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.toUTCString(); +}, '`let date = new Date(Date.now()); new date.toUTCString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/toUTCString/shell.js b/js/src/tests/test262/built-ins/Date/prototype/toUTCString/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T1.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T1.js new file mode 100644 index 0000000000..704878882a --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "valueOf" has { DontEnum } attributes +esid: sec-date.prototype.valueof +description: Checking absence of ReadOnly attribute +---*/ + +var x = Date.prototype.valueOf; +if (x === 1) { + Date.prototype.valueOf = 2; +} else { + Date.prototype.valueOf = 1; +} + +assert.notSameValue( + Date.prototype.valueOf, + x, + 'The value of Date.prototype.valueOf is expected to not equal the value of `x`' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T2.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T2.js new file mode 100644 index 0000000000..f19351c81b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "valueOf" has { DontEnum } attributes +esid: sec-date.prototype.valueof +description: Checking absence of DontDelete attribute +---*/ + +assert.notSameValue(delete Date.prototype.valueOf, false, 'The value of delete Date.prototype.valueOf is not false'); + +assert( + !Date.prototype.hasOwnProperty('valueOf'), + 'The value of !Date.prototype.hasOwnProperty(\'valueOf\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T3.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T3.js new file mode 100644 index 0000000000..e9c3021e81 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The Date.prototype property "valueOf" has { DontEnum } attributes +esid: sec-date.prototype.valueof +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.propertyIsEnumerable('valueOf'), + 'The value of !Date.prototype.propertyIsEnumerable(\'valueOf\') is expected to be true' +); + +for (var x in Date.prototype) { + assert.notSameValue(x, "valueOf", 'The value of x is not "valueOf"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A2_T1.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A2_T1.js new file mode 100644 index 0000000000..1653792cf0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A2_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "length" property of the "valueOf" is 0 +esid: sec-date.prototype.valueof +description: The "length" property of the "valueOf" is 0 +---*/ + +assert.sameValue( + Date.prototype.valueOf.hasOwnProperty("length"), + true, + 'Date.prototype.valueOf.hasOwnProperty("length") must return true' +); + +assert.sameValue(Date.prototype.valueOf.length, 0, 'The value of Date.prototype.valueOf.length is expected to be 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T1.js new file mode 100644 index 0000000000..24e84469c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.valueOf property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.valueof +description: Checking ReadOnly attribute +includes: [propertyHelper.js] +---*/ + +var x = Date.prototype.valueOf.length; +verifyNotWritable(Date.prototype.valueOf, "length", null, 1); + +assert.sameValue( + Date.prototype.valueOf.length, + x, + 'The value of Date.prototype.valueOf.length is expected to equal the value of x' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T2.js new file mode 100644 index 0000000000..9cfe3eab54 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.valueOf property "length" has { ReadOnly, ! + DontDelete, DontEnum } attributes +esid: sec-date.prototype.valueof +description: Checking DontDelete attribute +---*/ + +assert.sameValue( + delete Date.prototype.valueOf.length, + true, + 'The value of `delete Date.prototype.valueOf.length` is expected to be true' +); + +assert( + !Date.prototype.valueOf.hasOwnProperty('length'), + 'The value of !Date.prototype.valueOf.hasOwnProperty(\'length\') is expected to be true' +); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T3.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T3.js new file mode 100644 index 0000000000..5d3dcf9c67 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S15.9.5.8_A3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The Date.prototype.valueOf property "length" has { ReadOnly, DontDelete, + DontEnum } attributes +esid: sec-date.prototype.valueof +description: Checking DontEnum attribute +---*/ +assert( + !Date.prototype.valueOf.propertyIsEnumerable('length'), + 'The value of !Date.prototype.valueOf.propertyIsEnumerable(\'length\') is expected to be true' +); + +for (var x in Date.prototype.valueOf) { + assert.notSameValue(x, "length", 'The value of x is not "length"'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T1.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T1.js new file mode 100644 index 0000000000..65de790c8e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T1.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.valueof +info: | + Result of ToInteger(value) conversion is the result of computing + sign(ToNumber(value)) * floor(abs(ToNumber(value))) +es5id: 9.4_A3_T1 +description: For testing constructor Date(Number) is used +---*/ + +// CHECK#1 +var d1 = new Date(6.54321); +assert.sameValue(d1.valueOf(), 6, 'd1.valueOf() must return 6'); + +// CHECK#2 +var d2 = new Date(-6.54321); +assert.sameValue(d2.valueOf(), -6, 'd2.valueOf() must return -6'); + +// CHECK#3 +var d3 = new Date(6.54321e2); +assert.sameValue(d3.valueOf(), 654, 'd3.valueOf() must return 654'); + +// CHECK#4 +var d4 = new Date(-6.54321e2); +assert.sameValue(d4.valueOf(), -654, 'd4.valueOf() must return -654'); + +// CHECK#5 +var d5 = new Date(0.654321e1); +assert.sameValue(d5.valueOf(), 6, 'd5.valueOf() must return 6'); + +// CHECK#6 +var d6 = new Date(-0.654321e1); +assert.sameValue(d6.valueOf(), -6, 'd6.valueOf() must return -6'); + +// CHECK#7 +var d7 = new Date(true); +assert.sameValue(d7.valueOf(), 1, 'd7.valueOf() must return 1'); + +// CHECK#8 +var d8 = new Date(false); +assert.sameValue(d8.valueOf(), 0, 'd8.valueOf() must return 0'); + +// CHECK#9 +var d9 = new Date(1.23e15); +assert.sameValue(d9.valueOf(), 1.23e15, 'd9.valueOf() must return 1.23e15'); + +// CHECK#10 +var d10 = new Date(-1.23e15); +assert.sameValue(d10.valueOf(), -1.23e15, 'd10.valueOf() must return -1.23e15'); + +// CHECK#11 +var d11 = new Date(1.23e-15); +assert.sameValue(d11.valueOf(), 0, 'd11.valueOf() must return 0'); + +// CHECK#12 +var d12 = new Date(-1.23e-15); +assert.sameValue(d12.valueOf(), 0, 'd12.valueOf() must return 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js new file mode 100644 index 0000000000..e1747d60d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.valueof +info: | + Result of ToInteger(value) conversion is the result of computing + sign(ToNumber(value)) * floor(abs(ToNumber(value))) +es5id: 9.4_A3_T2 +description: > + For testing constructor Date(NaN, Infinity, Infinity, +0 and -0) + is used +---*/ + +// CHECK#1 +var d1 = new Date(Number.NaN); +assert.sameValue(d1.valueOf(), NaN, 'd1.valueOf() returns NaN'); + +// CHECK#2 +var d2 = new Date(Infinity); +assert.sameValue(d2.valueOf(), NaN, 'd2.valueOf() returns NaN'); + +// CHECK#3 +var d3 = new Date(-Infinity); +assert.sameValue(d3.valueOf(), NaN, 'd3.valueOf() returns NaN'); + +// CHECK#4 +var d4 = new Date(0); +assert.sameValue(d4.valueOf(), 0, 'd4.valueOf() must return 0'); + +// CHECK#5 +var d5 = new Date(-0); +assert.sameValue(d5.valueOf(), 0, 'd5.valueOf() must return 0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/browser.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/name.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/name.js new file mode 100644 index 0000000000..e1e16eb74b --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-date.prototype.valueof +description: > + Date.prototype.valueOf.name is "valueOf". +info: | + Date.prototype.valueOf ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Date.prototype.valueOf.name, "valueOf"); + +verifyNotEnumerable(Date.prototype.valueOf, "name"); +verifyNotWritable(Date.prototype.valueOf, "name"); +verifyConfigurable(Date.prototype.valueOf, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/not-a-constructor.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/not-a-constructor.js new file mode 100644 index 0000000000..5e333ff19e --- /dev/null +++ b/js/src/tests/test262/built-ins/Date/prototype/valueOf/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Date.prototype.valueOf does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Date.prototype.valueOf), + false, + 'isConstructor(Date.prototype.valueOf) must return false' +); + +assert.throws(TypeError, () => { + let date = new Date(Date.now()); new date.valueOf(); +}, '`let date = new Date(Date.now()); new date.valueOf()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Date/prototype/valueOf/shell.js b/js/src/tests/test262/built-ins/Date/prototype/valueOf/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3