-
-
Notifications
You must be signed in to change notification settings - Fork 758
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
ICU-22907 MF2: Finish updating spec tests and implement required test functions #3216
base: main
Are you sure you want to change the base?
ICU-22907 MF2: Finish updating spec tests and implement required test functions #3216
Conversation
2680b67
to
c3902e3
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
c3902e3
to
5f55d7c
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
5f55d7c
to
38500d3
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
51d2915
to
43b0280
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
43b0280
to
076ee46
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
076ee46
to
31abd17
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
… functions Implement :test:format, :test:select, and :test:function, which are required by the new `pattern-selection.json` tests. Change the internal value representation in the formatter in order to support some of the test cases (binding the results of selectors to a variable).
31abd17
to
99fe24c
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
This PR does everything that's needed in order to make the pattern-selection spec tests work.
This includes implementing the test-only standard functions,
test:function
,test:format
andtest:select
, specified in the test README file in the spec.This was tricky because the select-only
test:select
function is used in a composable way in these tests, which isn't something that appeared in previous tests. Previously, the code assumed that a named result of a selector could be used in a.match
, but not used as an operand to another function.So in this PR, I implement a limited form of what will eventually (see draft PR #3228, which is still in design review) be a more coherent mechanism for function composition. I implemented just enough of it to make these tests work.
I added an
InternalValue
type used in the formatter, which is distinct from theFormattedPlaceholder
type that function handlers return. This makes it easier to guarantee that fallback (error) values are not passed to functions. AnInternalValue
includes a function name, operand, and options. Since at the time when a resolved value is named, it's unknown whether it will be used for formatting or selection,InternalValue
has both a formatting and a selection method, which can be called when the resolved value is eventually consumed by either a.match
or a pattern.I had to modify the
depstest.py
script for the same reasons as before; now, code that manipulates variants is also found inmessageformat2_evaluation.cpp
, but as before, it's never used in a way that could throw an exception.I'll be happy to explain more and/or add comments to the code as needed.
Checklist