GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add more tests to validate the current command error handling behaviors by daxian-dbw · Pull Request #15919 · PowerShell/PowerShell

Conversation

@daxian-dbw

@daxian-dbw Dongbo Wang (daxian-dbw) commented Aug 12, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Summary

This PR adds 39 tests to validate and track the existing command error handling behaviors.
This PR is a preparation for #15177. The new tests added here will protect regressions that could be introduced to the command error handling by #15177.

Please be noted that those tests are by no means covering every aspect of the error handling behaviors.
I tried to cover most of the subtle behaviors -- some are not well known and may even be a little confusing to some extent. This is because these subtle behaviors may not be well tested, and adding those new tests will help guard me from introducing regression without knowing when working on #15177.
For the more obvious/common behaviors, I hope they are already covered by existing tests.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • Breaking changes
    • None
  • User-facing changes
    • Not Applicable
  • Testing - New and feature
    • Make sure you've added a new test if existing tests do not effectively test the code changed
  • Tooling
    • I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Dongbo Wang (daxian-dbw) added 2 commits August 12, 2021 10:11
@daxian-dbw
Add more tests to validate the current command error handling behaviors
f63f295
@daxian-dbw
Rename tests with better names
468c8f0
@ghost ghost assigned Ilya (iSazonov) Aug 12, 2021
@daxian-dbw Dongbo Wang (daxian-dbw) mentioned this pull request Aug 12, 2021
Add clean block to script block as a peer to begin, process, and end to allow easy resource cleanup #15177
Merged
15 tasks done
@daxian-dbw Dongbo Wang (daxian-dbw) assigned Aditya Patwardhan (adityapatwardhan) and unassigned Ilya (iSazonov) Aug 12, 2021
@daxian-dbw
Dongbo Wang (daxian-dbw) requested review from Aditya Patwardhan (adityapatwardhan), Ilya (iSazonov) and Rob Holt (rjmholt) August 12, 2021 22:41
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Aug 12, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

To combine the tests in Context-s in one (per Context) with TestCases - it would be great readable.

Ilya (@iSazonov), I already did my best grouping test cases with -TestCases. I believe being more aggressive grouping the remaining It tests will make the tests even harder to read.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) approved these changes Aug 13, 2021
View reviewed changes
Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov Ilya (iSazonov) added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Aug 13, 2021
@daxian-dbw
Use -Be instead of -BeExactly for number comparison
ac4e57a
rjmholt
Rob Holt (rjmholt) approved these changes Aug 13, 2021
View reviewed changes
Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1
1/0 ## throw exception.
Write-Verbose -Verbose "verbose-message"
}

@rjmholt Rob Holt (rjmholt) Aug 13, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Another good one here is parameter binding, where I hit some strangeness in #15833

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@daxian-dbw Dongbo Wang (daxian-dbw) Aug 13, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It would be great if you can add tests here (or to another file as you see fit) to cover the scenario after you get it fixed in #15833.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
adityapatwardhan
Aditya Patwardhan (adityapatwardhan) approved these changes Aug 14, 2021
View reviewed changes
Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw
Address Aditya's comments
8cf0dd0
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit eeb0407 into PowerShell:master Aug 14, 2021
@daxian-dbw
Dongbo Wang (daxian-dbw) deleted the errorHandling branch August 14, 2021 21:32
@iSazonov Ilya (iSazonov) added this to the 7.2.0-preview.9 milestone Aug 15, 2021
xtqqczze pushed a commit to xtqqczze/PowerShell-PowerShell that referenced this pull request Aug 20, 2021
@daxian-dbw @xtqqczze
Add more tests to validate the current command error handling behavio…
90e9d3a
…rs (PowerShell#15919)
@ghost

Deleted user (ghost) commented Aug 23, 2021

Copy link
Copy Markdown

🎉v7.2.0-preview.9 has been released which incorporates this pull request.:tada:

Handy links:

  • Release Notes
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

Deleted user (ghost) commented Sep 28, 2021

Copy link
Copy Markdown

🎉v7.2.0-preview.10 has been released which incorporates this pull request.:tada:

Handy links:

  • Release Notes
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@daxian-dbw
Add more tests to validate the current command error handling behavio…
9fc4dda
…rs (PowerShell#15919)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adityapatwardhan Aditya Patwardhan (adityapatwardhan) adityapatwardhan approved these changes
@iSazonov Ilya (iSazonov) iSazonov approved these changes
+1 more reviewer
@rjmholt Rob Holt (rjmholt) rjmholt approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@adityapatwardhan Aditya Patwardhan (adityapatwardhan)

Labels

CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Milestone

7.2.0-preview.9

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@daxian-dbw @rjmholt @adityapatwardhan @iSazonov
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.