mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Enable Write-Information to accept $null (#8774)
This commit is contained in:
@@ -165,6 +165,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// </summary>
|
||||
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true)]
|
||||
[Alias("Msg", "Message")]
|
||||
[AllowNull]
|
||||
public object MessageData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -114,5 +114,12 @@ Describe "Stream writer tests" -Tags "CI" {
|
||||
$result.Count | Should -Be $returnCount
|
||||
(Compare-Object $result $returnValue -SyncWindow 0).length | Should -Be 0
|
||||
}
|
||||
|
||||
It "Write-Information accepts `$Null" {
|
||||
$streamPath = Join-Path $testdrive information.txt
|
||||
$null | Write-Information -Tags myTag -ErrorAction Stop -InformationAction SilentlyContinue -InformationVariable i
|
||||
$i.Tags | Should -BeExactly "myTag"
|
||||
$i.MessageData | Should -Be $null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user