-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add tests for pattern selection #863
Conversation
- `never` (default) | ||
- `select` | ||
- `format` | ||
- `always` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these sufficiently self-documenting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're somewhat documented by the behaviour section below. Not explicitly documenting these is also in line with what we've done for all the other functions' option values.
@@ -209,173 +209,6 @@ | |||
} | |||
] | |||
}, | |||
{ | |||
"src": ".match {$foo :number} one {{one}} * {{other}}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file tests the function :number
(and its friend :integer
, which are specified as part of the standard function set*. Won't we need these tests for that purpose? The file is named appropriately for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests removed from here rely on the category selection behaviour of :number
, which is not strictly speaking required of an implementation, as we only say that "selection should be based on CLDR plural rule data". If that wiggle room is not intentional, then we should (separately from this PR) firm that up, and possibly introduce more specific tests for :number
that check a wider range of locales.
These tests also mostly exercise the MF2 spec side of pattern selection, for which each case is now included in the :test:select
tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should fix these tests to use CLDR data, if that's what we want. My primary concern is not to lose tests for something that is part of our collection of specifications, even if it isn't part of MF2's core spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep these :number
tests in as they are, we're requiring that a "should" in the spec is treated the same as a "MUST". If we do want to test this behaviour, the tests for it ought to be separate and somehow marked so that an implementation that chooses to do something else can ignore them.
The spec-required parts of these tests is completely retained in the :test:select
tests added in this PR.
I added #868 to continue the conversation about the spec language for :number
and :integer
selection.
Co-authored-by: Addison Phillips <[email protected]>
Currently, the tests we have for pattern selection rely on the behaviour of
:number
, and are somewhat incomplete. We should instead use:test:select
and:test:format
for this, and work to ensure more aspects are covered.A new
fails
option is added to the the test functions, to allow for the changes made in #828 to be testable (i.e. what happens if a custom selector function throws an error during MatchSelectorKeys).The
.match
tests on:number
are all moved to the new test suite.