From 3868f8f76580a229aa0ffdeeeafe091a7ca3e087 Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Wed, 29 Jun 2016 16:21:10 -0300 Subject: [PATCH] Update test for distinct NaN replacement on DefineOwnProperty Fixes gh-683 Ref gh-648 Ref tc39/ecma262#353 --- .../DefineOwnProperty/nan-equivalence.js | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/test/built-ins/Object/internals/DefineOwnProperty/nan-equivalence.js b/test/built-ins/Object/internals/DefineOwnProperty/nan-equivalence.js index 8290349292..07d2e19fa1 100644 --- a/test/built-ins/Object/internals/DefineOwnProperty/nan-equivalence.js +++ b/test/built-ins/Object/internals/DefineOwnProperty/nan-equivalence.js @@ -4,9 +4,16 @@ esid: sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc es6id: 9.1.6 description: > - Compares "value" field using SameValue algorithm (thereby ignoring distinct - NaN values) + Replaces value field even if they pass in the SameValue algorithm, including + distinct NaN values 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). 9.1.6.1 OrdinaryDefineOwnProperty @@ -19,9 +26,17 @@ info: | 9.1.6.3 ValidateAndApplyPropertyDescriptor [...] - 4. Return true, if every field in Desc also occurs in current and the value - of every field in Desc is the same value as the corresponding field in - current when compared using the SameValue algorithm. + 7. Else if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true, + then + 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] includes: [nans.js] ---*/ @@ -39,7 +54,7 @@ function byteValue(value) { /** * Iterate over each pair of distinct NaN values (with replacement). If two or * 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. */ for (idx = 0; idx < length; ++idx) { @@ -54,10 +69,10 @@ for (idx = 0; idx < length; ++idx) { subject.prop = first; subject.prop = second; - assert.notSameValue( + assert.sameValue( byteValue(subject.prop), byteValue(second), - 'Property value was not re-set' + 'Property value was re-set' ); } }