Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,7 @@ function ConvertTo-MOFInstance
}
else
{
if ($targetTypeName -notmatch 'Array' -or $p.Value.Count)
{
$p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n"
}
$p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n"
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions test/PSDesiredStateConfiguration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -439,4 +439,31 @@ MultiResourceConfig -OutputPath TestDrive:\MultiResourceConfig
"TestDrive:\MultiResourceConfig\localhost.mof" | Should -Exist
Get-Content -Raw -Path "TestDrive:\MultiResourceConfig\localhost.mof" | Write-Verbose -Verbose
}

It "Check empty array compilation" {

[Scriptblock]::Create(@"
configuration DSCEmptyArrayConfig
{
Import-DscResource -ModuleName xTestClassResource
Node "localhost" {
xTestClassResource f2
{
Name = 'TestName'
Value = 'TestValue'

sArray = @()
}
}
}

DSCEmptyArrayConfig -OutputPath TestDrive:\DSCEmptyArrayConfig
"@) | Should -Not -Throw

"TestDrive:\DSCEmptyArrayConfig\localhost.mof" | Should -Exist

$mofContent = Get-Content -Raw -Path "TestDrive:\DSCEmptyArrayConfig\localhost.mof"
$mofContent | Write-Verbose -Verbose
$mofContent -match '\ssArray\s=\s{\r\n};' | Should -BeTrue
}
}