8000 Start-Sleep: add 'ms' alias to '-Milliseconds' (#4039) · PowerShell/PowerShell@437d773 · GitHub
[go: up one dir, main page]

Skip to content

Commit 437d773

Browse files
Tadasdaxian-dbw
authored andcommitted
Start-Sleep: add 'ms' alias to '-Milliseconds' (#4039)
1 parent a8f9826 commit 437d773

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void Dispose()
5454
/// </summary>
5555
[Parameter(Mandatory = true, ParameterSetName = "Milliseconds", ValueFromPipelineByPropertyName = true)]
5656
[ValidateRangeAttribute(0, int.MaxValue)]
57+
[Alias("ms")]
5758
public int Milliseconds { get; set; }
5859

5960
#endregion

test/powershell/Modules/Microsoft.PowerShell.Utility/Start-Sleep.Tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,23 @@ Describe "Start-Sleep DRT Unit Tests" -Tags "CI" {
99
Start-Sleep -Seconds 1
1010
$watch.Stop()
1111
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
12+
$watch.ElapsedMilliseconds | Should BeLessThan 1050
1213
}
1314

1415
It "Should work properly when sleeping with Milliseconds" {
1516
$watch = [System.Diagnostics.Stopwatch]::StartNew()
1617
Start-Sleep -Milliseconds 1000
1718
$watch.Stop()
1819
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
20+
$watch.ElapsedMilliseconds | Should BeLessThan 1050
21+
}
22+
23+
It "Should work properly when sleeping with ms alias" {
24+
$watch = [System.Diagnostics.Stopwatch]::StartNew()
25+
Start-Sleep -ms 1000
26+
$watch.Stop()
27+
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
28+
$watch.ElapsedMilliseconds | Should BeLessThan 1050
1929
}
2030
}
2131

0 commit comments

Comments
 (0)
0