mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files. Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks. Separate PR coming to update contribution document for new source files: #6140 Manually reviewed each change. Fix #6073
30 lines
1.4 KiB
PowerShell
30 lines
1.4 KiB
PowerShell
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
Describe "Requires tests" -Tags "CI" {
|
|
Context "Parser error" {
|
|
|
|
$testcases = @(
|
|
@{command = "#requiresappID`r`n$foo = 1; $foo" ; testname = "appId with newline"}
|
|
@{command = "#requires -version A `r`n$foo = 1; $foo" ; testname = "version as character"}
|
|
@{command = "#requires -version 2b `r`n$foo = 1; $foo" ; testname = "alphanumeric version"}
|
|
@{command = "#requires -version 1. `r`n$foo = 1; $foo" ; testname = "version with dot"}
|
|
@{command = "#requires -version '' `r`n$foo = 1; $foo" ; testname = "empty version"}
|
|
@{command = "#requires -version 1.0. `r`n$foo = 1; $foo" ; testname = "version with two dots"}
|
|
@{command = "#requires -version 1.A `r`n$foo = 1; $foo" ; testname = "alphanumeric version with dots"}
|
|
)
|
|
|
|
It "throws ParserException - <testname>" -TestCases $testcases {
|
|
param($command)
|
|
try
|
|
{
|
|
[scriptblock]::Create($command)
|
|
throw "'$command' should have thrown ParserError"
|
|
}
|
|
catch
|
|
{
|
|
$_.FullyQualifiedErrorId | Should Be "ParseException"
|
|
}
|
|
}
|
|
}
|
|
|
|
} |