Remove tests for "quarter" option of Intl.DateTimeFormat (#2232)

This commit is contained in:
Frank Yung-Fong Tang 2019-07-15 10:51:22 -07:00 committed by Leo Balter
parent 53d14f56bb
commit f7e6656c13
5 changed files with 0 additions and 151 deletions

View File

@ -1,43 +0,0 @@
// Copyright 2019 Googe Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializedatetimeformat
description: Checks the order of getting options of 'quarter' for the DateTimeFormat constructor.
info: |
ToDateTimeOptions ( options, required, defaults )
4. If required is "date" or "any", then
a. For each of the property names "weekday", "year", "quarter", "month", "day", do
includes: [compareArray.js]
features: [Intl.DateTimeFormat-quarter]
---*/
// Just need to ensure quarter are get between year and month.
const expected = [
// ToDateTimeOptions step 4.
"year", "quarter", "month",
// InitializeDateTimeFormat step 22.
"year",
"quarter",
"month"
];
const actual = [];
const options = {
get month() {
actual.push("month");
return "numeric";
},
get quarter() {
actual.push("quarter");
return "long";
},
get year() {
actual.push("year");
return "numeric";
},
};
new Intl.DateTimeFormat("en", options);
assert.compareArray(actual, expected);

View File

@ -1,29 +0,0 @@
// Copyright 2019 Google Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializedatetimeformat
description: >
Checks error cases for the options argument to the DateTimeFormat constructor.
info: |
[[Quarter]] `"quarter"` `"narrow"`, `"short"`, `"long"`
InitializeDateTimeFormat ( dateTimeFormat, locales, options )
...
features: [Intl.DateTimeFormat-quarter]
---*/
const invalidOptions = [
"",
"LONG",
" long",
"short ",
"full",
"numeric",
];
for (const quarter of invalidOptions) {
assert.throws(RangeError, function() {
new Intl.DateTimeFormat("en", { quarter });
}, `new Intl.DateTimeFormat("en", { quarter: "${quarter}" }) throws RangeError`);
}

View File

@ -1,35 +0,0 @@
// Copyright 2019 Google Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializedatetimeformat
description: >
Checks handling of the options argument to the DateTimeFormat constructor.
info: |
[[Quarter]] `"quarter"` `"narrow"`, `"short"`, `"long"`
InitializeDateTimeFormat ( dateTimeFormat, locales, options )
...
features: [Intl.DateTimeFormat-quarter]
---*/
const validOptions = [
[undefined, undefined],
["long", "long"],
["short", "short"],
["narrow", "narrow"],
[{ toString() { return "narrow"; } }, "narrow"],
[{ valueOf() { return "long"; }, toString: undefined }, "long"],
];
for (const [quarter, expected] of validOptions) {
const dtf = new Intl.DateTimeFormat("en", { quarter });
const options = dtf.resolvedOptions();
assert.sameValue(options.quarter, expected);
const propdesc = Object.getOwnPropertyDescriptor(options, "quarter");
if (expected === undefined) {
assert.sameValue(propdesc, undefined);
} else {
assert.sameValue(propdesc.value, expected);
}
}

View File

@ -1,29 +0,0 @@
// Copyright 2019 Google Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.datetimeformat.prototype.resolvedoptions
description: Verifies the property order for the object returned by resolvedOptions().
includes: [compareArray.js]
features: [Intl.DateTimeFormat-quarter]
---*/
const options = new Intl.DateTimeFormat([], {
"year": "numeric",
"quarter": "short",
"month": "numeric",
"day": "numeric",
}).resolvedOptions();
const expected = [
"locale",
"calendar",
"numberingSystem",
"timeZone",
"year",
"quarter",
"month",
"day",
];
assert.compareArray(Object.getOwnPropertyNames(options), expected);

View File

@ -1,15 +0,0 @@
// Copyright 2019 Google Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializedatetimeformat
description: >
Tests that the behavior of a Record is not affected by adversarial changes to Object.prototype.
includes: [testIntl.js]
features: [Intl.DateTimeFormat-quarter]
---*/
taintProperties(["quarter"]);
var locale = new Intl.DateTimeFormat(undefined, {localeMatcher: "lookup"}).resolvedOptions().locale;
assert(isCanonicalizedStructurallyValidLanguageTag(locale), "DateTimeFormat returns invalid locale " + locale + ".");