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

ranger: Fix bugs and expand documentation #200

Merged
merged 3 commits into from
Dec 11, 2022

Conversation

matheusd
Copy link
Contributor

@matheusd matheusd commented Dec 8, 2022

This fixes a bug when looping over an unindex ranger (i.e. a ranger that
returns false for its ProvidesIndex() method).

Previously, the context for the range was not properly set, so it made
it impossible to use the context in such rangers.

This also fixes a panic when attempting to use an unindexed ranger
without a corresponding 'set' action.

Additionally, it adds additional documentation for how custom rangers should be written.

This fixes a bug when looping over an unindex ranger (i.e. a ranger that
returns false for its ProvidesIndex() method).

Previously, the context for the range was not properly set, so it made
it impossible to use the context in such rangers.

This also fixes a panic when attempting to use an unindexed ranger
without a corresponding 'set' action.
This adds test cases to assert using a custom ranger interface works as
expected.

It also modifies the previous slice tests to make it clear it's using
the index, unifying it with the other test case names.
@matheusd matheusd changed the title doc: Expand documentation for Ranger() ranger: Fix bugs and expand documentation Dec 8, 2022
@sauerbraten
Copy link
Collaborator

Thanks a lot! Feel free to complete the markdown docs as well, I saw the section on custom rangers is still marked as TODO: https://github.com/CloudyKit/jet/blob/master/docs/syntax.md#range

@sauerbraten sauerbraten merged commit f0a3bbc into CloudyKit:master Dec 11, 2022
@sauerbraten
Copy link
Collaborator

Oh and if you could describe the gist of the changes in one short sentence I can use in release notes, that would be great! I guess this is not a breaking change, but could some users be affected when they accidentally relied on the buggy behavior?

@matheusd
Copy link
Contributor Author

Will do. For future reference, what is your preferred method to receive the short sentences for use in release notes? In the PR itself? Or maybe we can start tracking such changes in a docs/next-release-changes.md (or whatever) file and enforce any relevant PRs/commits to have a line there?

@matheusd matheusd deleted the doc-ranger branch December 12, 2022 10:40
@sauerbraten
Copy link
Collaborator

I think it's enough if I ask for such a summary in the PRs when I don't think we have a deep enough understanding to write them myself. So feel free to write a comment here for now 👌

@matheusd
Copy link
Contributor Author

Release note:

Fixed a panic generated when ranging over a channel or other custom rangers without setting the value to variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants