From 16f3f494d3e8b0883079657c97bf7f7b4423500b Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang Date: Thu, 6 Jan 2022 18:32:00 -0800 Subject: [PATCH] fix test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. "–" => " – " 2. Move the verifyProperty after assert.sameValue because it has side effect of removing that property while it is writable. --- .../prototype/formatRangeToParts/en-US.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/intl402/NumberFormat/prototype/formatRangeToParts/en-US.js b/test/intl402/NumberFormat/prototype/formatRangeToParts/en-US.js index 9c06fab4e8..5f5d1c69f9 100644 --- a/test/intl402/NumberFormat/prototype/formatRangeToParts/en-US.js +++ b/test/intl402/NumberFormat/prototype/formatRangeToParts/en-US.js @@ -19,7 +19,11 @@ function* zip(a, b) { function compare(actual, expected) { for (const [i, actualEntry, expectedEntry] of zip(actual, expected)) { - + // assertions + assert.sameValue(actualEntry.type, expectedEntry.type, `type for entry ${i}`); + assert.sameValue(actualEntry.value, expectedEntry.value, `value for entry ${i}`); + assert.sameValue(actualEntry.source, expectedEntry.source, `source for entry ${i}`); + // 1.1.25_4.a Let O be ObjectCreate(%ObjectPrototype%). assert.sameValue(Object.getPrototypeOf(actualEntry), Object.prototype, `prototype for entry ${i}`); // 1.1.25_4.b Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]) @@ -28,11 +32,6 @@ function compare(actual, expected) { verifyProperty(actualEntry, 'value', { enumerable: true, writable: true, configurable: true }); // 1.1.25_4.d Perform ! CreateDataPropertyOrThrow(O, "source", part.[[Source]]). verifyProperty(actualEntry, 'source', { enumerable: true, writable: true, configurable: true }); - - // assertions - assert.sameValue(actualEntry.type, expectedEntry.type, `type for entry ${i}`); - assert.sameValue(actualEntry.value, expectedEntry.value, `value for entry ${i}`); - assert.sameValue(actualEntry.source, expectedEntry.source, `source for entry ${i}`); } } @@ -46,7 +45,7 @@ const nf = new Intl.NumberFormat("en-US", { compare(nf.formatRangeToParts(3, 5), [ {type: "currency", value: "$", source: "startRange"}, {type: "integer", value: "3", source: "startRange"}, - {type: "literal", value: "–", source: "shared"}, + {type: "literal", value: " – ", source: "shared"}, {type: "currency", value: "$", source: "endRange"}, {type: "integer", value: "5", source: "endRange"} ]);