mirror of https://github.com/tc39/test262.git
Ensure NaN time values are correctly handled in various Date setters
Related PR: https://github.com/tc39/ecma262/pull/2136
This commit is contained in:
parent
5ae7de9942
commit
92b592547d
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setyear
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setYear ( year )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let y be ? ToNumber(year).
|
||||
5. If t is NaN, set t to +0𝔽; otherwise, set t to LocalTime(t).
|
||||
6. Let yyyy be MakeFullYear(y).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setYear(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getYear(), 1, "date value correctly updated");
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setyear
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setYear ( year )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let y be ? ToNumber(year).
|
||||
5. If t is NaN, set t to +0𝔽; otherwise, set t to LocalTime(t).
|
||||
6. Let yyyy be MakeFullYear(y).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setYear(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getYear(), 1, "date value correctly updated");
|
36
test/built-ins/Date/prototype/setDate/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
36
test/built-ins/Date/prototype/setDate/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setdate
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setDate ( date )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let dt be ? ToNumber(date).
|
||||
5. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setDate(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
39
test/built-ins/Date/prototype/setDate/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
39
test/built-ins/Date/prototype/setDate/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setdate
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setDate ( date )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let dt be ? ToNumber(date).
|
||||
5. If t is NaN, return NaN.
|
||||
6. Set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setDate(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getDate(), 1, "date value correctly updated");
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setfullyear
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setFullYear ( year [ , month [ , date ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let y be ? ToNumber(year).
|
||||
5. If t is NaN, set t to +0𝔽; otherwise, set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setFullYear(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getFullYear(), 1, "date value correctly updated");
|
38
test/built-ins/Date/prototype/setFullYear/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
38
test/built-ins/Date/prototype/setFullYear/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setfullyear
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setFullYear ( year [ , month [ , date ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let y be ? ToNumber(year).
|
||||
5. If t is NaN, set t to +0𝔽; otherwise, set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setFullYear(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getFullYear(), 1, "date value correctly updated");
|
39
test/built-ins/Date/prototype/setHours/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
39
test/built-ins/Date/prototype/setHours/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.sethours
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let h be ? ToNumber(hour).
|
||||
5. If min is present, let m be ? ToNumber(min).
|
||||
6. If sec is present, let s be ? ToNumber(sec).
|
||||
7. If ms is present, let milli be ? ToNumber(ms).
|
||||
8. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setHours(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
42
test/built-ins/Date/prototype/setHours/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
42
test/built-ins/Date/prototype/setHours/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.sethours
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let h be ? ToNumber(hour).
|
||||
5. If min is present, let m be ? ToNumber(min).
|
||||
6. If sec is present, let s be ? ToNumber(sec).
|
||||
7. If ms is present, let milli be ? ToNumber(ms).
|
||||
8. If t is NaN, return NaN.
|
||||
9. Set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setHours(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getHours(), 1, "date value correctly updated");
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setmilliseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setMilliseconds ( ms )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Set ms to ? ToNumber(ms).
|
||||
5. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setMilliseconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setmilliseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setMilliseconds ( ms )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Set ms to ? ToNumber(ms).
|
||||
5. If t is NaN, return NaN.
|
||||
6. Set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setMilliseconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getMilliseconds(), 1, "date value correctly updated");
|
38
test/built-ins/Date/prototype/setMinutes/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
38
test/built-ins/Date/prototype/setMinutes/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setminutes
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setMinutes ( min [ , sec [ , ms ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(min).
|
||||
5. If sec is present, let s be ? ToNumber(sec).
|
||||
6. If ms is present, let milli be ? ToNumber(ms).
|
||||
7. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setMinutes(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
41
test/built-ins/Date/prototype/setMinutes/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
41
test/built-ins/Date/prototype/setMinutes/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setminutes
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setMinutes ( min [ , sec [ , ms ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(min).
|
||||
5. If sec is present, let s be ? ToNumber(sec).
|
||||
6. If ms is present, let milli be ? ToNumber(ms).
|
||||
7. If t is NaN, return NaN.
|
||||
8. Set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setMinutes(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getMinutes(), 1, "date value correctly updated");
|
37
test/built-ins/Date/prototype/setMonth/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
37
test/built-ins/Date/prototype/setMonth/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setmonth
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setMonth ( month [ , date ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(month).
|
||||
5. If date is present, let dt be ? ToNumber(date).
|
||||
6. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setMonth(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
44
test/built-ins/Date/prototype/setMonth/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
44
test/built-ins/Date/prototype/setMonth/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setmonth
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setMonth ( month [ , date ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(month).
|
||||
5. If date is present, let dt be ? ToNumber(date).
|
||||
6. If t is NaN, return NaN.
|
||||
7. Set t to LocalTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
// Change date from "Jan 1 1970" to "Jan 2 1970" to ensure this test passes in
|
||||
// all time zones.
|
||||
dt.setDate(2);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setMonth(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getMonth(), 1, "date value correctly updated");
|
37
test/built-ins/Date/prototype/setSeconds/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
37
test/built-ins/Date/prototype/setSeconds/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setSeconds ( sec [ , ms ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let s be ? ToNumber(sec).
|
||||
5. If ms is present, let milli be ? ToNumber(ms).
|
||||
6. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setSeconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
40
test/built-ins/Date/prototype/setSeconds/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
40
test/built-ins/Date/prototype/setSeconds/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setSeconds ( sec [ , ms ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. 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).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setSeconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getSeconds(), 1, "date value correctly updated");
|
36
test/built-ins/Date/prototype/setUTCDate/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
36
test/built-ins/Date/prototype/setUTCDate/date-value-read-before-tonumber-when-date-is-invalid.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcdate
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCDate ( date )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let dt be ? ToNumber(date).
|
||||
5. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCDate(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
39
test/built-ins/Date/prototype/setUTCDate/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
39
test/built-ins/Date/prototype/setUTCDate/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcdate
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCDate ( date )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let dt be ? ToNumber(date).
|
||||
5. If t is NaN, return NaN.
|
||||
6. Let newDate be MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t)).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCDate(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCDate(), 1, "date value correctly updated");
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcfullyear
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCFullYear ( year [ , month [ , date ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. If t is NaN, set t to +0𝔽.
|
||||
5. Let y be ? ToNumber(year).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCFullYear(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCFullYear(), 1, "date value correctly updated");
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcfullyear
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCFullYear ( year [ , month [ , date ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. If t is NaN, set t to +0𝔽.
|
||||
5. Let y be ? ToNumber(year).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCFullYear(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCFullYear(), 1, "date value correctly updated");
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutchours
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCHours ( hour [ , min [ , sec [ , ms ] ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let h be ? ToNumber(hour).
|
||||
5. If min is present, let m be ? ToNumber(min).
|
||||
6. If sec is present, let s be ? ToNumber(sec).
|
||||
7. If ms is present, let milli be ? ToNumber(ms).
|
||||
8. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCHours(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
42
test/built-ins/Date/prototype/setUTCHours/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
42
test/built-ins/Date/prototype/setUTCHours/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutchours
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCHours ( hour [ , min [ , sec [ , ms ] ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let h be ? ToNumber(hour).
|
||||
5. If min is present, let m be ? ToNumber(min).
|
||||
6. If sec is present, let s be ? ToNumber(sec).
|
||||
7. If ms is present, let milli be ? ToNumber(ms).
|
||||
8. If t is NaN, return NaN.
|
||||
9. If min is not present, let m be MinFromTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCHours(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCHours(), 1, "date value correctly updated");
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcmilliseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCMilliseconds ( ms )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Set ms to ? ToNumber(ms).
|
||||
5. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCMilliseconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcmilliseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCMilliseconds ( ms )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Set ms to ? ToNumber(ms).
|
||||
5. If t is NaN, return NaN.
|
||||
6. Let time be MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCMilliseconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCMilliseconds(), 1, "date value correctly updated");
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcminutes
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCMinutes ( min [ , sec [ , ms ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(min).
|
||||
5. If sec is present, let s be ? ToNumber(sec).
|
||||
6. If ms is present, let milli be ? ToNumber(ms).
|
||||
7. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCMinutes(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcminutes
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCMinutes ( min [ , sec [ , ms ] ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(min).
|
||||
5. If sec is present, let s be ? ToNumber(sec).
|
||||
6. If ms is present, let milli be ? ToNumber(ms).
|
||||
7. If t is NaN, return NaN.
|
||||
8. If sec is not present, let s be SecFromTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCMinutes(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCMinutes(), 1, "date value correctly updated");
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcmonth
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCMonth ( month [ , date ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(month).
|
||||
5. If date is present, let dt be ? ToNumber(date).
|
||||
6. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCMonth(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
40
test/built-ins/Date/prototype/setUTCMonth/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
40
test/built-ins/Date/prototype/setUTCMonth/date-value-read-before-tonumber-when-date-is-valid.js
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcmonth
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCMonth ( month [ , date ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let m be ? ToNumber(month).
|
||||
5. If date is present, let dt be ? ToNumber(date).
|
||||
6. If t is NaN, return NaN.
|
||||
7. If date is not present, let dt be DateFromTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCMonth(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCMonth(), 1, "date value correctly updated");
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is invalid.
|
||||
info: |
|
||||
Date.prototype.setUTCSeconds ( sec [ , ms ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let s be ? ToNumber(sec).
|
||||
5. If ms is present, let milli be ? ToNumber(ms).
|
||||
6. If t is NaN, return NaN.
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(NaN);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(0);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCSeconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.sameValue(result, NaN, "result is NaN");
|
||||
|
||||
assert.sameValue(dt.getTime(), 0, "time updated in valueOf");
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) 2024 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-date.prototype.setutcseconds
|
||||
description: >
|
||||
Read [[DateValue]] and then call ToNumber when stored time-value is valid.
|
||||
info: |
|
||||
Date.prototype.setUTCSeconds ( sec [ , ms ] )
|
||||
|
||||
...
|
||||
3. Let t be dateObject.[[DateValue]].
|
||||
4. Let s be ? ToNumber(sec).
|
||||
5. If ms is present, let milli be ? ToNumber(ms).
|
||||
6. If t is NaN, return NaN.
|
||||
7. If ms is not present, let milli be msFromTime(t).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dt = new Date(0);
|
||||
|
||||
var valueOfCalled = 0;
|
||||
|
||||
var value = {
|
||||
valueOf() {
|
||||
valueOfCalled++;
|
||||
dt.setTime(NaN);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
var result = dt.setUTCSeconds(value);
|
||||
|
||||
assert.sameValue(valueOfCalled, 1, "valueOf called exactly once");
|
||||
|
||||
assert.notSameValue(result, NaN, "result is not NaN");
|
||||
|
||||
assert.sameValue(result, dt.getTime(), "result is equal to getTime");
|
||||
|
||||
assert.sameValue(dt.getUTCSeconds(), 1, "date value correctly updated");
|
Loading…
Reference in New Issue