René's URL Explorer Experiment


Title: Test-Path: Return $false when given an empty or $null -Path/-LiteralPath value by vexx32 · Pull Request #8080 · PowerShell/PowerShell · GitHub

Open Graph Title: Test-Path: Return $false when given an empty or $null -Path/-LiteralPath value by vexx32 · Pull Request #8080 · PowerShell/PowerShell

X Title: Test-Path: Return $false when given an empty or $null -Path/-LiteralPath value by vexx32 · Pull Request #8080 · PowerShell/PowerShell

Description: PR Summary Fix #5717. Fix #8076. Test-Path is expected to be almost exclusively a True/False response cmdlet, and the cases where it may error or return an unexpected result are a few too many at present (see above issues). This PR allows $null / empty value(s) to be passed to Test-Path without throwing parameter binding exceptions. It also adds additional logic to Test-Path such that passing it $null, '', or ' ' (or any pure whitespace string) returns $false instead of throwing an error or returning $true on a "path" that is nothing but whitespace. New behaviour: PS> Test-Path ' ' False PS> Test-Path '' False PS> Test-Path @() False Error conditions: PS> Test-Path $null PS> Test-Path $null, $null These are non-terminating errors. A small handful of tests predicated on Test-Path failing in these cases have been updated to simply transform the error into terminating via -ErrorAction, as it appears that the important part of the test was not Test-Path itself, but throwing a terminating error in specific code strictures. Tests for the additional behaviours have also been added. PR Checklist PR has a meaningful title Use the present tense and imperative mood when describing your changes Summarized changes Change is not breaking 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: to the beginning of the title and remove the prefix when the PR is ready. User-facing changes Not Applicable OR User-facing Documentation needed Issue filed - Issue link: MicrosoftDocs/PowerShell-Docs#3165 Testing - New and feature Not Applicable or can only be tested interactively OR Make sure you've added a new test if existing tests do not effectively test the code changed Add [feature] if the change is significant or affects feature tests

Open Graph Description: PR Summary Fix #5717. Fix #8076. Test-Path is expected to be almost exclusively a True/False response cmdlet, and the cases where it may error or return an unexpected result are a few too many at p...

X Description: PR Summary Fix #5717. Fix #8076. Test-Path is expected to be almost exclusively a True/False response cmdlet, and the cases where it may error or return an unexpected result are a few too many at p...

Opengraph URL: https://github.com/PowerShell/PowerShell/pull/8080

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e05a564b-a6c7-11f0-2e2e-d07e88715347
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB24E:145838:229E36A:2E958CB:6A59A04F
html-safe-nonce3f5e06c36c58ff14dbedb63cfa77071efc320b5751282bb907358d50a361fdba
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjRFOjE0NTgzODoyMjlFMzZBOjJFOTU4Q0I6NkE1OUEwNEYiLCJ2aXNpdG9yX2lkIjoiNzYwNTMyNjAwNzAzNDgxNDU0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb2604bc95ba7609cb48037a7f8f46aef883c2a9eab09d08090b334b74f40f3ce
hovercard-subject-tagpull_request:224159830
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/PowerShell/PowerShell/pull/8080/files
twitter:imagehttps://avatars.githubusercontent.com/u/32407840?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/32407840?s=400&v=4
og:image:altPR Summary Fix #5717. Fix #8076. Test-Path is expected to be almost exclusively a True/False response cmdlet, and the cases where it may error or return an unexpected result are a few too many at p...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonea540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release0b971869dd75eec26500a9de7e85b8137c6bf0f6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/pull/8080/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fpull%2F8080%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fpull%2F8080%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/pull/8080/files
Reloadhttps://github.com/PowerShell/PowerShell/pull/8080/files
Reloadhttps://github.com/PowerShell/PowerShell/pull/8080/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/8080/files
PowerShell https://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Notifications https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Fork 8.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Star 54.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Code https://github.com/PowerShell/PowerShell
Issues 1.2k https://github.com/PowerShell/PowerShell/issues
Pull requests 290 https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality 3 https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
Code https://github.com/PowerShell/PowerShell
Issues https://github.com/PowerShell/PowerShell/issues
Pull requests https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FPowerShell%2FPowerShell%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FPowerShell%2FPowerShell%2Fissues%2Fnew%2Fchoose
iSazonovhttps://github.com/iSazonov
PowerShell:masterhttps://github.com/PowerShell/PowerShell/tree/master
vexx32:Test-Path/AllowNullhttps://github.com/vexx32/PowerShell/tree/Test-Path/AllowNull
Conversation 35 https://github.com/PowerShell/PowerShell/pull/8080
Commits 15 https://github.com/PowerShell/PowerShell/pull/8080/commits
Checks 0 https://github.com/PowerShell/PowerShell/pull/8080/checks
Files changed https://github.com/PowerShell/PowerShell/pull/8080/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/8080/files
Test-Path: Return $false when given an empty or $null -Path/-LiteralPath value https://github.com/PowerShell/PowerShell/pull/8080/files#top
Show all changes 15 commits https://github.com/PowerShell/PowerShell/pull/8080/files
1313095 Add empty / null path handling to Test-Path vexx32 Oct 19, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/13130954c6751cacdd3fa668f112856cf5fc2a6a
7d5735a Update tests to fail correctly under the sole remaining erroring cond… vexx32 Oct 19, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/7d5735a2f0a2b4726f207065284517dd93317ec6
2f41783 Use quick-exit code paths instead of lengthy if/else vexx32 Oct 19, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/2f41783737cbd4c8e69162c92a30a750f870538b
44417f5 Add non-terminating errors for null input vexx32 Oct 25, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/44417f5d806a894fba23ec6dbedb6cec77a8491c
63e1b8f Reformat test file for readability vexx32 Oct 25, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/63e1b8ff29716a31e4aa7cc450dc057005adf38e
d793658 Use more descriptive error ID vexx32 Oct 25, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/d793658efe8101a6637c72d40572264dfad0430a
794e78b Add Tests for new behaviour vexx32 Oct 25, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/794e78ba4bae8163c269af3f59d860f117644761
cae5294 Remove unnecessary blank line per StyleCop vexx32 Oct 25, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/cae5294b03a39ca295e65789485076f380d21a6b
60810ca Add new tests vexx32 Oct 30, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/60810ca085948377dd419b715fae724c5e4a9104
e731fab Clarify it name vexx32 Oct 30, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/e731fabfbf2a52d37dd64645121054cfafb3b54f
2008e51 Fix endless loop caused by change of error type in tests vexx32 Oct 30, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/2008e5174ca6028086a693874ee23768050d7d31
28cc91f Fix FullyQualifiedErrorID vexx32 Oct 31, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/28cc91f9225f2f950c436344244bdb0005234eff
0be7bf1 Consolidate ErrorIDs to match vexx32 Oct 31, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/0be7bf1f5a56edede09cc0d001b1b1e7e6cd4bfb
890fcb1 Add .resx file for TestPath vexx32 Nov 16, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/890fcb12b5437384183b34afe3ac48aad4fd816d
cddfb79 Use resource file for error string vexx32 Nov 16, 2018 https://github.com/PowerShell/PowerShell/pull/8080/commits/cddfb790d796ab53057ec07f5620c0664ac0c724
Clear filters https://github.com/PowerShell/PowerShell/pull/8080/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/8080/files
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/8080/files
PingPathCommand.cs https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
TestPathResources.resx https://github.com/PowerShell/PowerShell/pull/8080/files#diff-43cfc042bc4879dc87d48a1b906618818b690d17f72e9e76c2509e7d19128c24
ErrorPosition.Tests.ps1 https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
Test-Path.Tests.ps1 https://github.com/PowerShell/PowerShell/pull/8080/files#diff-68d9fe0dc73a010b75b54e242a2f7d2f9f079dc2045519d536a7249b742e9c14
https://github.com/PowerShell/PowerShell/blob/master/.github/CODEOWNERS#L7
src/Microsoft.PowerShell.Commands.Management/commands/management/PingPathCommand.cshttps://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
View file https://github.com/vexx32/PowerShell/blob/cddfb790d796ab53057ec07f5620c0664ac0c724/src/Microsoft.PowerShell.Commands.Management/commands/management/PingPathCommand.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/PowerShell/PowerShell/pull/8080/{{ revealButtonHref }}
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/8080/files
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-c6539f83e336f8d4109e4130083daeb531c0e5e4efd792ed575c872f44d38557
https://github.com/PowerShell/PowerShell/blob/master/.github/CODEOWNERS#L7
src/Microsoft.PowerShell.Commands.Management/resources/TestPathResources.resxhttps://github.com/PowerShell/PowerShell/pull/8080/files#diff-43cfc042bc4879dc87d48a1b906618818b690d17f72e9e76c2509e7d19128c24
View file https://github.com/vexx32/PowerShell/blob/cddfb790d796ab53057ec07f5620c0664ac0c724/src/Microsoft.PowerShell.Commands.Management/resources/TestPathResources.resx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/PowerShell/PowerShell/pull/8080/{{ revealButtonHref }}
https://github.com/PowerShell/PowerShell/blob/master/.github/CODEOWNERS#L7
test/powershell/Language/Scripting/ErrorPosition.Tests.ps1https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
View file https://github.com/vexx32/PowerShell/blob/cddfb790d796ab53057ec07f5620c0664ac0c724/test/powershell/Language/Scripting/ErrorPosition.Tests.ps1
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/PowerShell/PowerShell/pull/8080/{{ revealButtonHref }}
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
https://github.com/PowerShell/PowerShell/pull/8080/files#diff-b34afe25c3121ecada54cd22ae3028f4e36ccde40323705aebde0b08e0febcdd
Please reload this pagehttps://github.com/PowerShell/PowerShell/pull/8080/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.