Skip to content
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

Temporal "branding" tests are imprecise #3224

Closed
jugglinmike opened this issue Oct 1, 2021 · 0 comments · Fixed by #3579
Closed

Temporal "branding" tests are imprecise #3224

jugglinmike opened this issue Oct 1, 2021 · 0 comments · Fixed by #3579

Comments

@jugglinmike
Copy link
Contributor

Many of the tests intended to verify the "this value" (a.k.a "receiver") of the proposal's methods invoke those methods without providing the required arguments. In some cases, this omission would cause the expected TypeError when the implementation incorrectly tolerated an invalid receiver.

The test for Temporal.Duration.prototype.total currently demonstrates this hazard:

const total = Temporal.Duration.prototype.total;

assert.sameValue(typeof total, "function");

assert.throws(TypeError, () => total.call(undefined), "undefined");

If an implementation incorrectly accepted "undefined" as a receiver, it could still spuriously pass this test by throwing a TypeError for the omission of the required "options" argument (that is, by correctly implementing the subsequent step in the algorithm).

These tests should be modified to provide valid values where they are required. Although not all cases of argument omission is susceptible to this problem, the pattern is consistently misleading for human readers, so it should be addressed in all cases.

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

Successfully merging a pull request may close this issue.

1 participant