Skip to content

Add grep coverage to shell tests#7

Open
lydakis wants to merge 2 commits intomainfrom
codex/add-tests-for-grep-functionality
Open

Add grep coverage to shell tests#7
lydakis wants to merge 2 commits intomainfrom
codex/add-tests-for-grep-functionality

Conversation

@lydakis
Copy link
Copy Markdown
Owner

@lydakis lydakis commented Nov 16, 2025

Summary

  • seed the sandbox fixture with additional files containing predictable patterns and regex targets
  • add regression tests covering grep -n, grep -i, and recursive regex searches to ensure the host fallback behaves as expected

Testing

  • uv run pytest

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_shell.py
Comment on lines +62 to +65
shell = setup_shell()
res = shell.exec("grep -e 'regex[0-9]+' -r /workspace/docs")
assert "/workspace/docs/guide.txt:regex123" in res.stdout
assert "/workspace/docs/reference/spec.txt:prefix regex999 suffix" in res.stdout
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fix grep regex test to use extended syntax

The new test_grep_recursive_regex asserts that grep -e 'regex[0-9]+' -r /workspace/docs finds two matches, but GNU grep defaults to basic regular expressions where + is treated as a literal character. Without escaping + or passing -E, the command never matches regex123 or regex999, so res.stdout stays empty and the test always fails with exit code 1. Please either escape the plus (regex[0-9]\+) or run grep -E so the quantifier works and the test reflects the intended behavior.

Useful? React with 👍 / 👎.

@lydakis
Copy link
Copy Markdown
Owner Author

lydakis commented Nov 17, 2025

@codex

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Updated the recursive regex test to run grep with the -E flag so the + quantifier is interpreted as intended, ensuring both expected matches appear in stdout. tests/test_shell.pyL61-L65

Testing

  • uv run pytest tests/test_shell.py -k grep_recursive_regex

View task →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant