mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Add regression tests for custom key bindings
Also tests capitalized key bindings, hence the need to compare case sensitively.
This commit is contained in:
1 parent
59624e9b2f
commit
9cc6673b27
1 file changed
+12
-1
@@ -20,7 +20,7 @@ Describe "PSReadLine" -tags "CI" {
|
|||||||
|
|
||||||
It "Should use Windows Bindings on Windows" -skip:(-not $IsWindows) {
|
It "Should use Windows Bindings on Windows" -skip:(-not $IsWindows) {
|
||||||
(Get-PSReadLineOption).EditMode | Should Be Windows
|
(Get-PSReadLineOption).EditMode | Should Be Windows
|
||||||
(Get-PSReadlineKeyHandler | where { $_.Key -eq "Ctrl+A" }).Function | Should Be SelectAll
|
(Get-PSReadlineKeyHandler | where { $_.Key -eq "Ctrl+a" }).Function | Should Be SelectAll
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should set the edit mode" {
|
It "Should set the edit mode" {
|
||||||
@@ -31,6 +31,17 @@ Describe "PSReadLine" -tags "CI" {
|
|||||||
(Get-PSReadlineKeyHandler | where { $_.Key -eq "Ctrl+A" }).Function | Should Be BeginningOfLine
|
(Get-PSReadlineKeyHandler | where { $_.Key -eq "Ctrl+A" }).Function | Should Be BeginningOfLine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It "Should allow custom bindings for plain keys" {
|
||||||
|
Set-PSReadlineKeyHandler -Key '"' -Function SelfInsert
|
||||||
|
(Get-PSReadLineKeyHandler | where { $_.Key -eq '"' }).Function | Should Be SelfInsert
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Should report Capitalized bindings correctly" {
|
||||||
|
Set-PSReadlineOption -EditMode Emacs
|
||||||
|
(Get-PSReadLineKeyHandler | where { $_.Key -ceq "Alt+b" }).Function | Should Be BackwardWord
|
||||||
|
(Get-PSReadLineKeyHandler | where { $_.Key -ceq "Alt+B" }).Function | Should Be SelectBackwardWord
|
||||||
|
}
|
||||||
|
|
||||||
AfterAll {
|
AfterAll {
|
||||||
Remove-Module PSReadLine
|
Remove-Module PSReadLine
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user