Skip to content

Fixed uninitialized variable in the help function that was causing it to fail in strict mode - #6781

Closed
Bruce Payette (BrucePay) wants to merge 1 commit into
PowerShell:masterfrom
BrucePay:brucepay_HelpStrictMode
Closed

Bruce Payette (BrucePay) wants to merge 1 commit into
PowerShell:masterfrom
BrucePay:brucepay_HelpStrictMode

Conversation

@BrucePay

Copy link
Copy Markdown
Collaborator

PR #Summary

Fix for #6497. Changed the "help" function in InitialSessionState.cs to initialize the problematic variable so the function won't fail.

PR Checklist

@daxian-dbw

Copy link
Copy Markdown
Member

Bruce Payette (@BrucePay) The PR #6059 is going to remove the more function. Shall we skip this PR and request #6059 to add the test from this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo from, probably also remove the trailing punctuation which is inconsistent with general comments

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps: $help | Should -Not -BeEmptyOrNull instead? If it should fail, the test failure output may make it easier to understand what is going on

Help
}
# the help function renders the help content as text so just verify that there is content
$help | Should -Not -BeNullOrEmpty $true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the $true should not be needed.

describe 'test' {
   it 'failing test' {
       '' | should -not -BeNullOrEmpty
   }
   it 'passing test' {
       '' | should -BeNullOrEmpty
   }
 }

@TravisEz13 Travis Plunk (TravisEz13) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

see comment

@daxian-dbw

Copy link
Copy Markdown
Member

PR #6059 removes the more function and also includes this fix (test as well). So I will close this PR.

@BrucePay
Bruce Payette (BrucePay) deleted the brucepay_HelpStrictMode branch May 31, 2018 23:57
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.

4 participants