Update test for distinct NaN replacement on DefineOwnProperty

Fixes gh-683
Ref gh-648
Ref tc39/ecma262#353
This commit is contained in:
Leonardo Balter 2016-06-29 16:21:10 -03:00 committed by Mike Pennisi
parent 3a5a09eba2
commit 3868f8f765
1 changed files with 23 additions and 8 deletions

View File

@ -4,9 +4,16 @@
esid: sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc esid: sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
es6id: 9.1.6 es6id: 9.1.6
description: > description: >
Compares "value" field using SameValue algorithm (thereby ignoring distinct Replaces value field even if they pass in the SameValue algorithm, including
NaN values) distinct NaN values
info: | info: |
Previously, this method compared the "value" field using the SameValue
algorithm (thereby ignoring distinct NaN values)
---
[[DefineOwnProperty]] (P, Desc)
1. Return ? OrdinaryDefineOwnProperty(O, P, Desc). 1. Return ? OrdinaryDefineOwnProperty(O, P, Desc).
9.1.6.1 OrdinaryDefineOwnProperty 9.1.6.1 OrdinaryDefineOwnProperty
@ -19,9 +26,17 @@ info: |
9.1.6.3 ValidateAndApplyPropertyDescriptor 9.1.6.3 ValidateAndApplyPropertyDescriptor
[...] [...]
4. Return true, if every field in Desc also occurs in current and the value 7. Else if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true,
of every field in Desc is the same value as the corresponding field in then
current when compared using the SameValue algorithm. a. If the [[Configurable]] field of current is false, then
[...]
b. Else the [[Configurable]] field of current is true, so any change is
acceptable.
[...]
9. If O is not undefined, then
a. For each field of Desc that is present, set the corresponding attribute
of the property named P of object O to the value of the field.
10. Return true.
features: [Float64Array, Uint8Array] features: [Float64Array, Uint8Array]
includes: [nans.js] includes: [nans.js]
---*/ ---*/
@ -39,7 +54,7 @@ function byteValue(value) {
/** /**
* Iterate over each pair of distinct NaN values (with replacement). If two or * Iterate over each pair of distinct NaN values (with replacement). If two or
* more suitable NaN values cannot be identified, the semantics under test * more suitable NaN values cannot be identified, the semantics under test
* cannot be verfied and this test is expected to pass without evaluating any * cannot be verified and this test is expected to pass without evaluating any
* assertions. * assertions.
*/ */
for (idx = 0; idx < length; ++idx) { for (idx = 0; idx < length; ++idx) {
@ -54,10 +69,10 @@ for (idx = 0; idx < length; ++idx) {
subject.prop = first; subject.prop = first;
subject.prop = second; subject.prop = second;
assert.notSameValue( assert.sameValue(
byteValue(subject.prop), byteValue(subject.prop),
byteValue(second), byteValue(second),
'Property value was not re-set' 'Property value was re-set'
); );
} }
} }