Skip to content

Add assert_string_matches_format assertion#591

Merged
Chemaclass merged 2 commits intomainfrom
feat/assert-string-matches-format
Feb 21, 2026
Merged

Add assert_string_matches_format assertion#591
Chemaclass merged 2 commits intomainfrom
feat/assert-string-matches-format

Conversation

@Chemaclass
Copy link
Copy Markdown
Member

🤔 Background

Related #177

Adds PHPUnit-style format matching assertions, allowing users to validate strings against format patterns with placeholders instead of writing raw regex.

💡 Changes

  • Add assert_string_matches_format and assert_string_not_matches_format assertions
  • Support placeholders: %d (digits), %i (signed int), %f (float), %s (non-whitespace), %x (hex), %e (scientific), %% (literal %)
  • Add internal bashunit::format_to_regex helper that converts format strings to regex with proper escaping
  • Add 11 unit tests covering all placeholders, multiple placeholders, failure messages, and the inverse assertion

@Chemaclass Chemaclass added the enhancement New feature or request label Feb 21, 2026
@Chemaclass Chemaclass self-assigned this Feb 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ Contributor Report

User: @Chemaclass
Status: Passed (13/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 93% >= 30%
Repo Quality Repos with ≥100 stars 6 >= 0
Positive Reactions Positive reactions received 157 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 4569 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 173 >= 0
Merger Diversity Unique maintainers who merged PRs 8 >= 2
Repo History Merge Rate Merge rate in this repo 89% >= 0%
Repo History Min PRs Previous PRs in this repo 126 >= 0
Profile Completeness Profile richness (bio, followers) 100 >= 0
Suspicious Patterns Spam-like activity detection 0 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-02-21 to 2026-02-21

@Chemaclass Chemaclass force-pushed the feat/assert-string-matches-format branch from 6a427f0 to 43f78cb Compare February 21, 2026 14:35
Adds PHPUnit-style format assertions with placeholders:
%d (digits), %i (signed int), %f (float), %s (non-whitespace),
%x (hex), %e (scientific), %% (literal percent).
@Chemaclass Chemaclass force-pushed the feat/assert-string-matches-format branch from 43f78cb to a457dd3 Compare February 21, 2026 14:37
@Chemaclass Chemaclass force-pushed the feat/assert-string-matches-format branch from b7f40a8 to d9f117a Compare February 21, 2026 14:47
@Chemaclass Chemaclass changed the title feat(assert): add assert_string_matches_format assertion Add assert_string_matches_format assertion Feb 21, 2026
@Chemaclass Chemaclass merged commit c038c02 into main Feb 21, 2026
25 checks passed
@Chemaclass Chemaclass deleted the feat/assert-string-matches-format branch February 21, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant