test262/test/built-ins/Date/construct_with_date.js
André Bargull df9bf58204 Tests for changes introduced in ES2015 (Annex E)
- String case functions iterate over code points
- Has called before Get in Array.p.reverse
- Add test for web-compat Array.p.splice behaviour; Plus missing test for no arguments case
- ToObject no longer applied to this-value in Array.p.toLocaleString
- ToObject no longer applied to this-value in Object.p.toLocaleString
- Add tests for Object.p.propertyIsEnumerable and symbol property keys
- Add tests for Object.p.hasOwnProperty and symbol property keys
- Test property descriptor attributes of message property
- Tests for RegExp constructor checks
- Date constructor when called with date object
- TimeClip never returns negative zero
2015-09-07 17:25:55 +02:00

29 lines
732 B
JavaScript
Executable File

// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Date constructor called with Date object
info: >
20.3.2.2 Date ( value )
...
3. If NewTarget is not undefined, then
a. If Type(value) is Object and value has a [[DateValue]] internal slot, then
i. Let tv be thisTimeValue(value).
es6id: 20.3.2.2
---*/
var dateValue = 1438560000000;
var oldDate = new Date(dateValue);
oldDate.toString = function() {
$ERROR("toString() method called");
};
oldDate.valueOf = function() {
$ERROR("valueOf() method called");
};
var newDate = new Date(oldDate);
assert.sameValue(newDate.getTime(), dateValue, "Same date value");