Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/code/PSScriptMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ value continued
string keyName = "";
string value = "";

for (int i = 1; i < commentLines.Length; i++)
for (int i = 0; i < commentLines.Length; i++)
{
string line = commentLines[i];

Expand Down
14 changes: 14 additions & 0 deletions test/TestPSScriptFileInfo.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,18 @@ Describe "Test Test-PSScriptFileInfo" {

Test-PSScriptFileInfo $scriptFilePath | Should -Be $false
}

It "determine script without empty lines in PSScriptInfo comment content is valid" {
$scriptName = "ScriptWithoutEmptyLinesInMetadata.ps1"
$scriptFilePath = Join-Path $script:testScriptsFolderPath -ChildPath $scriptName

Test-PSScriptFileInfo $scriptFilePath | Should -Be $true
}

It "determine script without empty lines between comment blocks is valid" {
$scriptName = "ScriptWithoutEmptyLinesBetweenCommentBlocks.ps1"
$scriptFilePath = Join-Path $script:testScriptsFolderPath -ChildPath $scriptName

Test-PSScriptFileInfo $scriptFilePath | Should -Be $true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

<#PSScriptInfo
.VERSION 1.0
.GUID 3951be04-bd06-4337-8dc3-a620bf539fbd
.AUTHOR annavied
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
<#

.DESCRIPTION
this is a test for a script that will be published remotely

#>
Param()
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

<#PSScriptInfo
.VERSION 1.0
.GUID 3951be04-bd06-4337-8dc3-a620bf539fbd
.AUTHOR annavied
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>

<#
.DESCRIPTION
this is a test for a script that will be published remotely
#>
Param()