-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
Fix Tests #892
Conversation
Turns out it's only spaces? git/git@f3fc4a1 |
I'm genuinely confused how this test ever passed. git/git@dbfdc62 is from 2010. 🤔 |
5f58c7d
to
153fff5
Compare
test/DefaultPrompt.Tests.ps1
Outdated
@@ -531,17 +533,12 @@ M test/Baz.Tests.ps1 | |||
Context 'Removing the posh-git module' { | |||
It 'Correctly reverts the Window Title back to original state' { | |||
Set-Item function:\prompt -Value ([Runspace]::DefaultRunspace.InitialSessionState.Commands['prompt']).Definition | |||
$originalTitle = & $module Get-Variable OriginalWindowTitle -ValueOnly |
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.
Why not?
$originalTitle = & $module { $OriginalWindowTitle }
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.
But do it after importing posh-git
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.
Ah, now I see you're capturing this variable in the test fixture before the test runs.
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.
Why not?
$originalTitle = & $module { $OriginalWindowTitle }
I don't use this syntax often, so I refer to
Line 7 in 5a87e8a
# PS> & $m Get-Variable invokeErrors -ValueOnly |
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.
Just a few suggestions otherwise LGTM
test/DefaultPrompt.Tests.ps1
Outdated
@@ -531,17 +533,12 @@ M test/Baz.Tests.ps1 | |||
Context 'Removing the posh-git module' { | |||
It 'Correctly reverts the Window Title back to original state' { | |||
Set-Item function:\prompt -Value ([Runspace]::DefaultRunspace.InitialSessionState.Commands['prompt']).Definition | |||
$originalTitle = & $module Get-Variable OriginalWindowTitle -ValueOnly |
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.
But do it after importing posh-git
test/TabExpansion.Tests.ps1
Outdated
@@ -357,7 +358,7 @@ Describe 'TabExpansion Tests' { | |||
$result | Should -BeExactly "'v2.0.0'''" | |||
} | |||
It 'Tab completes add file in working dir with special char as quoted' { | |||
$filename = 'foo{bar} (x86).txt'; | |||
$filename = 'foo{bar} ��(x86).txt'; |
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.
What's with the unrecognized chars? Is that part of the "special char" test? Might be worth adding as another test for emoji/unprintable chars or whatever that is. IIRC this test was meant to check for tab completion with PowerShell and/or regex special chars/syntax e.g. {}
and ()
in the completed text.
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.
Was just being lazy, but yeah the emoji is to ensure we're setting core.quotePath
(and it's working as expected). Will break out as a separate test.
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.
What's with the unrecognized chars? Is that part of the "special char" test? Might be worth adding as another test for emoji/unprintable chars or whatever that is. IIRC this test was meant to check for tab completion with PowerShell and/or regex special chars/syntax e.g.
{}
and()
in the completed text.Was just being lazy, but yeah the emoji is to ensure we're setting
core.quotePath
(and it's working as expected). Will break out as a separate test.
Turns out we already had a (better) test for this:
posh-git/test/TabExpansion.Tests.ps1
Lines 222 to 226 in a62f90c
It 'Tab completes non-ASCII file name' { | |
&$gitbin config core.quotepath true # Problematic (default) config | |
$fileName = "posh$([char]8226)git.txt" | |
New-Item $fileName -ItemType File |
Relocated into the appropriate Context
.
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.
Thanks for the review, @rkeithhill
test/DefaultPrompt.Tests.ps1
Outdated
@@ -531,17 +533,12 @@ M test/Baz.Tests.ps1 | |||
Context 'Removing the posh-git module' { | |||
It 'Correctly reverts the Window Title back to original state' { | |||
Set-Item function:\prompt -Value ([Runspace]::DefaultRunspace.InitialSessionState.Commands['prompt']).Definition | |||
$originalTitle = & $module Get-Variable OriginalWindowTitle -ValueOnly |
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.
Why not?
$originalTitle = & $module { $OriginalWindowTitle }
I don't use this syntax often, so I refer to
Line 7 in 5a87e8a
# PS> & $m Get-Variable invokeErrors -ValueOnly |
test/TabExpansion.Tests.ps1
Outdated
@@ -357,7 +358,7 @@ Describe 'TabExpansion Tests' { | |||
$result | Should -BeExactly "'v2.0.0'''" | |||
} | |||
It 'Tab completes add file in working dir with special char as quoted' { | |||
$filename = 'foo{bar} (x86).txt'; | |||
$filename = 'foo{bar} ��(x86).txt'; |
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.
What's with the unrecognized chars? Is that part of the "special char" test? Might be worth adding as another test for emoji/unprintable chars or whatever that is. IIRC this test was meant to check for tab completion with PowerShell and/or regex special chars/syntax e.g.
{}
and()
in the completed text.Was just being lazy, but yeah the emoji is to ensure we're setting
core.quotePath
(and it's working as expected). Will break out as a separate test.
Turns out we already had a (better) test for this:
posh-git/test/TabExpansion.Tests.ps1
Lines 222 to 226 in a62f90c
It 'Tab completes non-ASCII file name' { | |
&$gitbin config core.quotepath true # Problematic (default) config | |
$fileName = "posh$([char]8226)git.txt" | |
New-Item $fileName -ItemType File |
Relocated into the appropriate Context
.
Following on from #878, trying to get back to all green.
Expected: 'igf ' But was: 'git checkout '
seems to be a change in how either Pester or PowerShell handles-Scope Script
; changing to-Scope Global
seems to fix. (@dscho you were close!)core.quotepath=false
(from b689b5e in Fix tab expansion for non-ASCII file paths #403) no longer affectsgit status -sb
as expected - a path with special characters is coming back in""
regardless. This feels like a regression, but I haven't gone looking for release notes.