From ab29fd3225dbf850ef15bebb414e5c65854cd62e Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang Date: Thu, 21 Jul 2022 13:30:08 -0700 Subject: [PATCH] Sync to PR701 (#3609) In 2022-07-20 TC39 we decide to take https://github.com/tc39/ecma402/pull/701 and not check the order of the x and y see https://docs.google.com/presentation/d/1UUvbf3FFu9PGtrPAKPdMad9DZuVFLIvkAsAxyJZyvxM/ for details --- ...-throws.js => date-x-greater-than-y-not-throws.js} | 10 +++------- ...-throws.js => date-x-greater-than-y-not-throws.js} | 11 +++-------- 2 files changed, 6 insertions(+), 15 deletions(-) rename test/intl402/DateTimeFormat/prototype/formatRange/{date-x-greater-than-y-throws.js => date-x-greater-than-y-not-throws.js} (77%) rename test/intl402/DateTimeFormat/prototype/formatRangeToParts/{date-x-greater-than-y-throws.js => date-x-greater-than-y-not-throws.js} (77%) diff --git a/test/intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-throws.js b/test/intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-not-throws.js similarity index 77% rename from test/intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-throws.js rename to test/intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-not-throws.js index 57e6ae592b..d5539520c6 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-throws.js +++ b/test/intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-not-throws.js @@ -1,9 +1,9 @@ -// Copyright 2019 Google, Inc. All rights reserved. +// Copyright 2022 Google, Inc. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - Throws a RangeError if date x is greater than y. + Return a string if date x is greater than y. info: | Intl.DateTimeFormat.prototype.formatRange ( startDate , endDate ) @@ -17,7 +17,6 @@ info: | 2. If x is NaN, throw a RangeError exception. 3. Let y be TimeClip(y). 4. If y is NaN, throw a RangeError exception. - 5. If x is greater than y, throw a RangeError exception. features: [Intl.DateTimeFormat-formatRange] ---*/ @@ -28,10 +27,7 @@ var x = new Date(); var y = new Date(); x.setDate(y.getDate() + 1); -assert.throws(RangeError, function() { - dtf.formatRange(x, y); -}, "x > y"); - +assert.sameValue("string", typeof dtf.formatRange(x, y)); assert.sameValue("string", typeof dtf.formatRange(x, x)); assert.sameValue("string", typeof dtf.formatRange(y, y)); assert.sameValue("string", typeof dtf.formatRange(y, x)); diff --git a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-throws.js b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-not-throws.js similarity index 77% rename from test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-throws.js rename to test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-not-throws.js index c7c095bf0f..ac0cfe3bfe 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-throws.js +++ b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-not-throws.js @@ -1,9 +1,9 @@ -// Copyright 2019 Google, Inc. All rights reserved. +// Copyright 2022 Google, Inc. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - Throws a RangeError if date x is greater than y. + Return an object if date x is greater than y. info: | Intl.DateTimeFormat.prototype.formatRangeToParts ( startDate , endDate ) @@ -12,13 +12,10 @@ info: | 6. Return ? FormatDateTimeRangeToParts(dtf, x, y). PartitionDateTimeRangePattern ( dateTimeFormat, x, y ) - 1. Let x be TimeClip(x). 2. If x is NaN, throw a RangeError exception. 3. Let y be TimeClip(y). 4. If y is NaN, throw a RangeError exception. - 5. If x is greater than y, throw a RangeError exception. - features: [Intl.DateTimeFormat-formatRange] ---*/ @@ -28,9 +25,7 @@ var x = new Date(); var y = new Date(); x.setDate(y.getDate() + 1); -assert.throws(RangeError, function() { - dtf.formatRangeToParts(x, y); -}, "x > y"); +assert.sameValue("object", typeof dtf.formatRangeToParts(x, y)); assert.sameValue("object", typeof dtf.formatRangeToParts(x, x)); assert.sameValue("object", typeof dtf.formatRangeToParts(y, y)); assert.sameValue("object", typeof dtf.formatRangeToParts(y, x));