Skip to content

Correct invalid tests for the Date constructor #573

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

Merged
merged 2 commits into from
Apr 19, 2016

Conversation

jugglinmike
Copy link
Contributor

The millisecond representation of a given Date instance is dependent on
the local system's time zone settings. In order to pass consistently
across contexts, tests for this value must take the system configuration
into account.

Introduce a test harness utility function to encapsulate these concerns.
Re-use this function across all test files that assert the exact
millisecond representation of Date instances.

@littledan As noted in the original BugZilla report, this approach complicates
the tests, but it doesn't quite depend on the semantics under test, so it
should be "safe."

That said, another solution occurred to me while writing this: we could make a
specific time zone (say, Greenwich Mean Time) a formal requirement to executing
Test262. This seems like the same class of problems I am trying to address in
gh-508. That is: limiting runtime variability through requirements
specification.

...But maybe it's a little too presumptuous to ask consumers to re-configure
their system clocks before running the tests. It certainly seems like overkill
for these 6 files, but doing so would let us forget about this detail entirely
(instead of carrying around another helper function and remembering to use it).

Resolves gh-528 (and https://bugs.ecmascript.org/show_bug.cgi?id=293 before it)

The millisecond representation of a given Date instance is dependent on
the local system's time zone settings. In order to pass consistently
across contexts, tests for this value must take the system configuration
into account.

Introduce a test harness utility function to encapsulate these concerns.
Re-use this function across all test files that assert the exact
millisecond representation of Date instances.
@jugglinmike jugglinmike changed the title Correct invalide tests for the Date constructor Correct invalid tests for the Date constructor Apr 12, 2016
$ERROR('Expected error, but no error was thrown.');
} else if (thrown.constructor !== Test262Error) {
$ERROR('Expected error of type Test262Error.');
}
Copy link
Member

Choose a reason for hiding this comment

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

why don't we use assert.throws here? I'm assuming you're avoiding the use of other harness, is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@leobalter
Copy link
Member

LGTM, my comments above shouldn't block anything.

@leobalter
Copy link
Member

@littledan I'm +1 to merge this. Would you confirm this fixes #528?

@leobalter leobalter merged commit cf68c3b into tc39:master Apr 19, 2016
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.

2 participants