Make Invoke-Formatter test case assertion fail in case of incorrect casing by alexandear · Pull Request #1888 · PowerShell/PSScriptAnalyzer
PR Summary
This PR fixes the test "corrects case of of cmdlet inside interpolated string" for Invoke-Formatter. It follows #1885 which didn't fully fixed the test.
Additional Info
The idea is to use -BeExactly for case-sensitive strings comparison.
With changes in the PR the test fails when the expected string is '"$(get-childItem)"':
[-] UseCorrectCasing.corrects case of of cmdlet inside interpolated string 19ms (17ms|1ms)
Expected strings to be the same, but they were different.
String lengths are both 18.
Strings differ at index 3.
Expected: '"$(get-childItem)"'
But was: '"$(Get-ChildItem)"'
---^
at Invoke-Formatter '"$(get-childitem)"' | Should -BeExactly '"$(get-childItem)"', /Users/redko.o/src/github.com/PowerShell/PSScriptAnalyzer/Tests/Rules/UseCorrectCasing.tests.ps1:14
at <ScriptBlock>, /Users/redko.o/src/github.com/PowerShell/PSScriptAnalyzer/Tests/Rules/UseCorrectCasing.tests.ps1:14
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
.cs,.ps1and.psm1files have the correct copyright header - Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
- 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.
- If the PR is work in progress, please add the prefix