Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make expErrors use an array (and only an array) #1076

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 2 commits into
base: main
Choose a base branch
from

Conversation

mihnita
Copy link
Collaborator

@mihnita mihnita commented Jun 2, 2025

Fixes issue #993

@mihnita mihnita force-pushed the mihai_issue_933 branch from e0def62 to b0e39a0 Compare June 2, 2025 15:03
@mihnita mihnita force-pushed the mihai_issue_933 branch from b0e39a0 to 3f11bcb Compare June 2, 2025 15:20
@mihnita mihnita requested review from eemeli, mradbourne and aphillips and removed request for eemeli June 2, 2025 15:22
@@ -5,7 +5,7 @@
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": false
"expErrors": []
Copy link
Member

Choose a reason for hiding this comment

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

In fallback.md you left out expErrors. Here you supply an empty array. I think we should probably omit this one?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@aphillips It's required in this file otherwise some tests would be left without an expectation (e.g. lines 44-55). This would also be the case in time.json.

As Eemeli mentioned in his review comment, I think we need to keep the expErrors in fallback.md.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we are talking about fallback.json, not fallback.md?

I updated fallback.json and added errors for each individual case, instead of doing it in defaultTestProperties

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For date.json, datetime.json and time.json I added "expErrors": [] to defaultTestProperties because the schema says that entries are required to have one of exp, expParts or expErrors

In these 3 files we had tests with src only.
So I had to add a expErrors (not enough info for exp, expParts, exact date/time formatting not part of the spec)

@@ -5,7 +5,7 @@
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": false
"expErrors": []
Copy link
Member

Choose a reason for hiding this comment

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

ibid

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see above

@aphillips aphillips added the test-suite Issue pertains to tests label Jun 2, 2025
@aphillips aphillips changed the title Issue 993: make expErrors only Make expErrors use an array (and only an array) Jun 2, 2025
@@ -4,8 +4,7 @@
"description": "Test cases for fallback behaviour.",
"defaultTestProperties": {
"bidiIsolation": "none",
"locale": "en-US",
"expErrors": true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was dropping this intentional? All of the messages in this file are expected to experience fallback and emit at least one error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added what I though to be the most appropriate errors for each case.


For :test:function fails=format the test/README.md is not specific enough, it only says "will emit a Message Function Error".

So from all the message function errors I chose the one that I though might be the best fit, Bad Operand, and I also updated the README.md file with it.

I did that for both fails=format and fails=select.

Copy link
Collaborator

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Some fixes, may need a second pass later to make sure I caught everything.

@@ -155,7 +155,7 @@ the behaviour of calling it as the `rv` value of MatchSelectorKeys(`rv`, `keys`)
depends on its `Input`, `DecimalPlaces` and `FailsSelect` values.

- If `FailsSelect` is `true`,
calling the method will emit a _Message Function Error_
calling the method will emit a _Message Function Error_ of type _Bad Operand_
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
calling the method will emit a _Message Function Error_ of type _Bad Operand_
calling the method will emit a _Bad Operand_ error

@@ -185,7 +185,7 @@ rather than being concatenated into a single string.

If `FailsFormat` is `true`,
attempting to format the _placeholder_ to any formatting target will
emit a _Message Function Error_.
emit a _Message Function Error_ of type _Bad Operand_.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
emit a _Message Function Error_ of type _Bad Operand_.
emit a _Bad Operand_ error.

},
{
"description": "unannotated implicit input variable",
"src": "{$var}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "bad-operand" }]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"expErrors": [{ "type": "bad-operand" }]
"expErrors": [{ "type": "unresolved-variable" }]

},
{
"description": "annotated implicit input variable",
"src": "{$var :number}",
"exp": "{$var}",
"expParts": [{ "type": "fallback", "source": "$var" }]
"expParts": [{ "type": "fallback", "source": "$var" }],
"expErrors": [{ "type": "bad-operand" }]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"expErrors": [{ "type": "bad-operand" }]
"expErrors": [{ "type": "unresolved-variable" }, { "type": "bad-operand" }]

},
{
"description": "function with local variable operand with unknown function in declaration",
"src": ".local $var = {|val| :test:undefined} {{{$var :test:function}}}",
"exp": "{$var}"
"exp": "{$var}",
"expErrors": [{ "type": "unknown-function" }]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"expErrors": [{ "type": "unknown-function" }]
"expErrors": [{ "type": "unknown-function" }, { "type": "bad-operand" }]

},
{
"description": "function with no operand",
"src": "{:test:undefined}",
"exp": "{:test:undefined}",
"expParts": [{ "type": "fallback", "source": ":test:undefined" }]
"expParts": [{ "type": "fallback", "source": ":test:undefined" }],
"expErrors": [{ "type": "bad-operand" }]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"expErrors": [{ "type": "bad-operand" }]
"expErrors": [{ "type": "unknown-function" }]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test-suite Issue pertains to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants