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

Add support for #@elif clauses in Test files #5960

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

reiniscirpons
Copy link
Member

@reiniscirpons reiniscirpons commented Mar 15, 2025

This PR adds the behaviour requested in #5652 by supporting #@elif clauses in test files.

Resolves #5652

Text for release notes

See title.

Further details

The behaviour is implemented by modifying the existing state machine used for parsing #@if ... #@else ... #@fi statements in ParseTestInput. This is done in a way where the state transitions are identical to what they were prior to this PR in tests using only #@if and #@else clauses. So, this change should be backwards compatible with existing test cases and shouldn't introduce new bugs in test cases that do not use #@elif.

The only other potential issue might be in test cases that have #@elif as an output line, e.g.

gap> Print("#@elif 1+1 = 2\n");
#@elif 1+1 = 2

is a valid test case prior to this PR, but after this PR it would lead to a test case syntax error when parsing. I was not able to find any such instances in the gap codebase, or the codebase of any packages we distribute. So I think its ok to call the change backwards compatible.

Copy link
Contributor

@ChrisJefferson ChrisJefferson left a comment

Choose a reason for hiding this comment

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

Thanks!

@ChrisJefferson ChrisJefferson added the release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes label Mar 20, 2025
@ChrisJefferson ChrisJefferson changed the title Add support for #@elif clauses in Test. Add support for #@elif clauses in Test files Mar 20, 2025
@ChrisJefferson
Copy link
Contributor

I slightly tweaked the title, just so it could be used directly in the release notes (which are plain text)

@fingolfin
Copy link
Member

@ChrisJefferson actually the release notes are not plaintext, they use MarkDown, so it was better before...

@fingolfin fingolfin changed the title Add support for #@elif clauses in Test files Add support for #@elif clauses in Test files Mar 20, 2025
Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Great!

@fingolfin fingolfin merged commit 3f12bf3 into gap-system:master Mar 20, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Test to support #@elif
3 participants