Skip to content

Fix parsing bugs and add tests to artichoke-readline #2597

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

Merged
merged 4 commits into from
Jun 11, 2023

Conversation

lopopolo
Copy link
Member

Pair programming with ChatGPT: https://chat.openai.com/c/f1a56877-ed9a-4fa9-92a8-9b0fe4763e82

Changes:

  • Disallow quotes around vi and emacs values in set directive.
  • Permit trailing garbage after a valid set directive.
  • treat vi and emacs directive values as case-insensitive.
  • When the input config contains multiple set directives, the last one wins.

Many more tests are added, generated with help:

  • Integration tests with full configs.
  • Tests with invalid UTF-8 byte strings.
  • Tests with multi-byte UTF-8 characters.
  • Tests with lots of differing variations of whitespace.
  • Tests with comments.
  • Tests with invalid directives.
  • Tests to exercise case-insensitive parsing.

Added some additional comments to the parser to clarify parse steps.

lopopolo added 3 commits June 10, 2023 17:38
Fix some bugs with the help of ChatGPT:

- Quoted values are not allowed in `set` directives per GNU Readline
  documentation.
- Handle trailing garbage after a valid `set` directive.
- `emacs` and `vi` directive values are case insensitive.

Add many more tests:

- Integration tests with full configs.
- Lots of tests with invalid UTF-8 byte sequences.
- Lots of tests with multi-byte UTF-8 characters.

Bump artichoke-readline to v1.0.1.
@lopopolo lopopolo added A-parser Area: Parser implementations. A-frontend Area: Frontends for interpreters, like the `ruby` or `irb` binaries. C-quality Category: Refactoring, cleanup, and quality improvements. labels Jun 11, 2023
@lopopolo lopopolo merged commit 8a59233 into trunk Jun 11, 2023
@lopopolo lopopolo deleted the lopopolo/readline-config-more-tests branch June 11, 2023 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Frontends for interpreters, like the `ruby` or `irb` binaries. A-parser Area: Parser implementations. C-quality Category: Refactoring, cleanup, and quality improvements.
Development

Successfully merging this pull request may close these issues.

1 participant