mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Enable type conversion of AutomationNull to $null for assignment (#19415)
This commit is contained in:
@@ -30,6 +30,18 @@ Describe "Scripting.Followup.Tests" -Tags "CI" {
|
||||
$arraylist.Count | Should -Be 0
|
||||
}
|
||||
|
||||
It 'AutomationNull should be same as null for type conversion' {
|
||||
$result = pwsh -noprofile -command {
|
||||
class Example {
|
||||
[string[]]$LogMessage
|
||||
}
|
||||
|
||||
[Example] @{ LogMessage = [System.Management.Automation.Internal.AutomationNull]::Value }
|
||||
}
|
||||
|
||||
$result.LogMessage | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
## fix https://github.com/PowerShell/PowerShell/issues/17165
|
||||
It "([bool] `$var = 42) should return the varaible value" {
|
||||
([bool]$var = 42).GetType().FullName | Should -Be "System.Boolean"
|
||||
|
||||
Reference in New Issue
Block a user