Skip to content

Commit

Permalink
add test cases for issue #67, version patterns with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jantari committed Dec 19, 2022
1 parent d595dcb commit 4f31033
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/Test-VersionPattern.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Describe 'Test-VersionPattern' {
Test-VersionPattern -LenovoString '10.0.0.1' -SystemString '10.0.0.1' | Should -Be 0
}

It 'Correctly trims spaces' {
Test-VersionPattern -LenovoString ' 26.20.100.7812' -SystemString '30.40.50' | Should -Be -1
Test-VersionPattern -LenovoString '26.20.100.7812 ' -SystemString '30.40.50' | Should -Be -1
Test-VersionPattern -LenovoString ' ^26.20.100.7812' -SystemString '10.20.30' | Should -Be 0
Test-VersionPattern -LenovoString '^ 26.20.100.7812' -SystemString '10.20.30' | Should -Be 0
}

It 'Lenovo Pattern - Less than' {
Test-VersionPattern -LenovoString '^10.0.0.1' -SystemString '10.0.2.2' | Should -Be -1
}
Expand All @@ -32,9 +39,7 @@ Describe 'Test-VersionPattern' {

It 'Lenovo Pattern Unsupported' {
Test-VersionPattern -LenovoString '^1^' -SystemString '8.0' | Should -Be -2
}

It 'Lenovo Pattern Unsupported' {
Test-VersionPattern -LenovoString '1.2.3+' -SystemString '8.0' | Should -Be -2
Test-VersionPattern -LenovoString '-100' -SystemString '8.0' | Should -Be -2
}

Expand Down

1 comment on commit 4f31033

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PSScriptAnalyzer results as of this commit:

  • 2 Information
  • 8 Warning
See details
Location : ./private/Debug-LongRunningProcess.ps1 [44, 13]
RuleName : PSAvoidUsingEmptyCatchBlock
Severity : Warning
Message  : Empty catch block is used. Please use Write-Error or throw statements in catc
           h blocks.

Location : ./private/Debug-LongRunningProcess.ps1 [126, 82]
RuleName : PSReviewUnusedParameter
Severity : Warning
Message  : The parameter 'lParam' has been declared but not used. 

Location : ./private/Resolve-XMLDependencies.ps1 [1, 10]
RuleName : PSUseSingularNouns
Severity : Warning
Message  : The cmdlet 'Resolve-XMLDependencies' uses a plural noun. A singular noun shou
           ld be used instead.

Location : ./private/Set-BIOSUpdateRegistryFlag.ps1 [1, 10]
RuleName : PSUseShouldProcessForStateChangingFunctions
Severity : Warning
Message  : Function 'Set-BIOSUpdateRegistryFlag' has verb that could change system state
           . Therefore, the function has to support 'ShouldProcess'.

Location : ./private/Split-ExecutableAndArguments.ps1 [1, 10]
RuleName : PSUseSingularNouns
Severity : Warning
Message  : The cmdlet 'Split-ExecutableAndArguments' uses a plural noun. A singular noun
            should be used instead.

Location : ./private/Invoke-PackageCommand.ps1 [293, 25]
RuleName : PSAvoidUsingEmptyCatchBlock
Severity : Warning
Message  : Empty catch block is used. Please use Write-Error or throw statements in catc
           h blocks.

Location : ./private/Compare-Array.ps1 [30, 17]
RuleName : PSReviewUnusedParameter
Severity : Warning
Message  : The parameter 'in' has been declared but not used. 

Location : ./public/Install-LSUpdate.ps1 [135, 21]
RuleName : PSUseOutputTypeCorrectly
Severity : Information
Message  : The cmdlet 'Install-LSUpdate' returns an object of type 'PackageInstallResult
           ' but this type is not declared in the OutputType attribute.

Location : ./public/Install-LSUpdate.ps1 [172, 21]
RuleName : PSUseOutputTypeCorrectly
Severity : Information
Message  : The cmdlet 'Install-LSUpdate' returns an object of type 'PackageInstallResult
           ' but this type is not declared in the OutputType attribute.

Location : ./public/Set-LSUClientConfiguration.ps1 [1, 10]
RuleName : PSUseShouldProcessForStateChangingFunctions
Severity : Warning
Message  : Function 'Set-LSUClientConfiguration' has verb that could change system state
           . Therefore, the function has to support 'ShouldProcess'.

Please sign in to comment.