Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AboutAssertions - Avoid Casting [Blank] to [bool] #316

Merged
merged 2 commits into from
Oct 29, 2019

Conversation

vexx32
Copy link
Owner

@vexx32 vexx32 commented Oct 29, 2019

PR Summary

PS's built-in boolean-casting behaviour cannot be overridden for reference types casting to bool, so any assertion that results in $blank | Should -BeTrue where $blank is an instance of [Blank] (obtained usually from Get-Blank / __ / ____) will automatically pass.

The usual fix is to avoid framing assertions in this way.

Context

Resolves #315

Changes

  • Reframe affected assertions to avoid the casting behaviour.
  • Update parts of the intstruction comments.

Checklist

  • Pull Request has a meaningful title.
  • Summarised changes.
  • Pull Request is ready to merge & is not WIP.
  • Added tests / only testable interactively.
    • Make sure you add a new test if old tests do not effectively test the code changed.
  • Added documentation / opened issue to track adding documentation at a later date.

This cast always returns $true, so don't pass [Blank] to Should -BeTrue
@vexx32 vexx32 added PR-Needs-Review 🔍 Let's take a closer look! Category-Koans Invoking the Great Doubt labels Oct 29, 2019
@vexx32 vexx32 merged commit 99ece96 into master Oct 29, 2019
@vexx32 vexx32 deleted the Bug/Koans/AboutAssertions branch October 29, 2019 13:14
@vexx32 vexx32 removed the PR-Needs-Review 🔍 Let's take a closer look! label Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Koans Invoking the Great Doubt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with AboutAssertions
1 participant