Skip to content

Fix the regex in ConsoleHost.Tests.ps1 used to verify help content - #28308

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
daxian-dbw:test-fix
Nov 3, 2026
Merged

Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
daxian-dbw:test-fix

Conversation

@daxian-dbw

Copy link
Copy Markdown
Member

PR Summary

Fix the regex used in ConsoleHost.Tests.ps1 for validating help content.
The original pattern is simply wrong. For example, "This is unrelated output" matches the original pattern:

PS:30>  "This is unrelated output" -match "pwsh[.exe] -Help | -? | /?"
True

Copilot AI balanced review requested due to automatic review settings November 3, 2026 19:09
@daxian-dbw
Dongbo Wang (daxian-dbw) requested a review from a team as a code owner November 3, 2026 19:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Nov 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The help-output assertion update has no active review issues.

No open issues 🎉

What changed in this PR

This PR corrects the help-output assertion in the ConsoleHost tests so unrelated output no longer satisfies it.

Changes:

  • Escapes regex metacharacters to match the literal help synopsis.
  • Adds -h to the expected synopsis alongside -Help, -?, and /?.
File Description
test/​powershell/​Host/​ConsoleHost.Tests.ps1 Corrects the regex used to validate output for help parameters.

Review effort: Balanced

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 01b9a93 into PowerShell:master Nov 3, 2026
36 checks passed
@daxian-dbw
Dongbo Wang (daxian-dbw) deleted the test-fix branch November 3, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.7.x-Consider CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants