Skip to content

feat: extract RegexLib and add test suite#1

Open
corvid-agent wants to merge 1 commit intomainfrom
feat/test-suite
Open

feat: extract RegexLib and add test suite#1
corvid-agent wants to merge 1 commit intomainfrom
feat/test-suite

Conversation

@corvid-agent
Copy link
Copy Markdown
Owner

Summary

  • Extracted pure logic from the monolithic executable into a RegexLib library target (Sources/RegexLib/RegexLib.swift): makeRegex, explainPattern, escapeRegex, parseArgs, ParsedArgs, ExplainToken, and RegexToolError
  • Added 72 tests across 10 suites covering all extracted functions (anchors, character classes, quantifiers, escape sequences, groups, alternation, literals, error descriptions, argument parsing, and regex escaping)
  • Updated Package.swift to define three targets: RegexLib (library), fledge-regex (executable), and RegexTests (test target)
  • Added README with accurate usage examples for all five commands (test, match, replace, explain, escape)

Test plan

  • swift build succeeds
  • swift test passes all 72 tests
  • Manual smoke test: swift run fledge-regex test '\d+' 'abc123'
  • Manual smoke test: swift run fledge-regex explain '^\d{3}-\d{4}$'
  • Manual smoke test: swift run fledge-regex escape 'hello (world)'

🤖 Generated with Claude Code

Split the monolithic executable into a RegexLib library target and a
CLI target. The library exposes makeRegex, explainPattern, escapeRegex,
parseArgs, ParsedArgs, ExplainToken, and RegexToolError as public API.
Added 72 tests covering all extracted functions. Added README with
usage examples for all commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant