mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
Allow combining of -Skip and -SkipLast parameters in Select-Object cmdlet. (#18849)
* Added SkipLast parameter set to Skip parameter and updated tests * Using Should -BeExactly with string * Update test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1 --------- Co-authored-by: Travis Plunk <travis.plunk@microsoft.com> Co-authored-by: Travis Plunk <github@ez13.net>
This commit is contained in:
2 files changed
+25
-1
No files matched your search
@@ -231,6 +231,29 @@ Describe "Select-Object DRT basic functionality" -Tags "CI" {
|
||||
$results[1] | Should -Be 3
|
||||
}
|
||||
|
||||
It "Select-Object with SkipLast should work" {
|
||||
$results = "1", "2", "3" | Select-Object -SkipLast 1
|
||||
$results.Count | Should -Be 2
|
||||
$results[0] | Should -BeExactly "1"
|
||||
$results[1] | Should -BeExactly "2"
|
||||
}
|
||||
|
||||
It "Select-Object with Skip and SkipLast should work" {
|
||||
$results = "1", "2", "3" | Select-Object -Skip 1 -SkipLast 1
|
||||
$results.Count | Should -Be 1
|
||||
$results[0] | Should -BeExactly "2"
|
||||
}
|
||||
|
||||
It "Select-Object with Skip and SkipLast should work with Skip overlapping SkipLast" {
|
||||
$results = "1", "2" | Select-Object -Skip 2 -SkipLast 1
|
||||
$results. Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "Select-Object with Skip and SkipLast should work with skiplast overlapping skip" {
|
||||
$results = "1", "2" | Select-Object -Skip 1 -SkipLast 2
|
||||
$results. Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "Select-Object with Index should work" {
|
||||
$results = "1", "2", "3" | Select-Object -Index 2
|
||||
$results.Count | Should -Be 1
|
||||
|
||||
Reference in new issue
Block a user