Skip to content

Add missing tests for 'length' value of Intl.Locale.prototype methods #4515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anba
Copy link
Contributor

@anba anba commented Jun 4, 2025

I've noticed this when reviewing the tests for Intl.Locale.prototype.variants.

@anba anba requested a review from a team as a code owner June 4, 2025 13:10
features: [Intl.DisplayNames]
---*/

verifyProperty(Intl.DisplayNames.prototype.of, "length", {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you instead update the other tests to use verifyPrimordialCallableProperty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verifyPrimordialCallableProperty doesn't support accessor methods, therefore I've instead used plain verifyProperty throughout this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verifyPrimordialCallableProperty doesn't support accessor methods, therefore I've instead used plain verifyProperty throughout this PR.

Yes it does, and I'm specifically planning for uses like test/intl402/Locale/prototype/baseName/descriptor.js:

var desc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "baseName");
var isHardened = Object.isFrozen(Object);
if (isHardened && desc.get) {
  Object.defineProperty(desc, "get", { configurable: false });
}

assert.sameValue(desc.value, undefined);
assert.sameValue(desc.set, undefined);
verifyCallableProperty(desc, "get", "get baseName", 0, { configurable: !isHardened });

verifyPrimordialProperty(Intl.Locale.prototype, "baseName", {
  enumerable: false,
  configurable: true,
});

I'm also open to making even better accommodations, e.g.

var desc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "baseName");

assert.sameValue(desc.value, undefined);
assert.sameValue(desc.set, undefined);
verifyPrimordialCallable(desc.get, "get baseName", 0);

verifyPrimordialProperty(Intl.Locale.prototype, "baseName", {
  enumerable: false,
  configurable: true,
});

Copy link
Contributor

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants