Skip to content

✅ test(mq-lang): expand =~ operator and is_regex_match test coverage#1310

Merged
harehare merged 3 commits intofeat/regex-match-operatorfrom
copilot/sub-pr-1305
Feb 21, 2026
Merged

✅ test(mq-lang): expand =~ operator and is_regex_match test coverage#1310
harehare merged 3 commits intofeat/regex-match-operatorfrom
copilot/sub-pr-1305

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 21, 2026

Test coverage for the =~ regex match operator and is_regex_match builtin was minimal, missing key behavioral cases. Adds the following test cases:

=~ operator tests:

  • regex_none_inputNone =~ pattern returns false
  • regex_markdown_match – matching Markdown text node returns Markdown(Text("true"))
  • regex_markdown_non_match – non-matching Markdown text node returns Markdown(Text("false"))
  • regex_in_if=~ used as a conditional predicate: "test" | if (. =~ "test"): true else: false
  • regex_invalid_pattern – malformed regex (e.g. "[invalid") propagates an error

is_regex_match builtin tests:

  • is_regex_match_matchis_regex_match("test1", "[a-z0-9]+") returns true
  • is_regex_match_no_matchis_regex_match("abc", "[0-9]+") returns false
  • is_regex_match_none_inputis_regex_match(., pattern) with None input returns false
  • is_regex_match_markdown – Markdown text node input returns Markdown(Text("true"))
  • is_regex_match_invalid_pattern – malformed regex propagates an error

Note: Markdown input cases return Markdown(Text("true"/"false")) rather than Boolean, consistent with how the mq engine wraps non-Markdown results when the input is a Markdown node (same behavior as matches_url).


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add =~ regex match operator and is_regex_match builtin ✅ test(mq-lang): expand =~ operator test coverage Feb 21, 2026
Copilot AI requested a review from harehare February 21, 2026 03:37
@harehare
Copy link
Copy Markdown
Owner

@copilot
Please add some tests for is_regex_match?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot
Please add some tests for is_regex_match?

Added direct is_regex_match tests in commit ae78427:

  • is_regex_match_matchis_regex_match("test1", "[a-z0-9]+") returns true
  • is_regex_match_no_matchis_regex_match("abc", "[0-9]+") returns false
  • is_regex_match_none_inputis_regex_match(., "[a-z]+") with None input returns false
  • is_regex_match_markdown – Markdown text input returns Markdown(Text("true"))
  • is_regex_match_invalid_patternis_regex_match("abc", "[invalid") returns an error

Copilot AI changed the title ✅ test(mq-lang): expand =~ operator test coverage ✅ test(mq-lang): expand =~ operator and is_regex_match test coverage Feb 21, 2026
@harehare harehare marked this pull request as ready for review February 21, 2026 03:49
@harehare harehare merged commit afdbca9 into feat/regex-match-operator Feb 21, 2026
@harehare harehare deleted the copilot/sub-pr-1305 branch February 21, 2026 03:51
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