大家好,我写了一个示例脚本来查找给定的字符串是否为回文,如下所示
function Palindrome1([string] $param)
{
[string] $ReversString
$StringLength = @()
$StringLength = $param.Length
while ( $StringLength -ge 0 )
{
$ReversString = $ReversString + $param[$StringLength]
$StringLength--
}
if($ReversString -eq $param)
{
return $true
}
else
{
return $false
}
}
这是我的.tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "Palindrome1" {
It "does something useful" {
Palindrome1 "radar" | Should Be $true
}
}
下面是调用脚本
$modulePath = "D:\Pester-master\Pester.psm1"
$SourceDir = "E:\Pester"
Import-Module $modulePath -ErrorAction Inquire
$outputFile = Join-Path $SourceDir "TEST-pester.xml"
$result = Invoke-Pester -Path $SourceDir -CodeCoverage "$SourceDir\*.ps1" -PassThru -OutputFile $outputFile
$result
我没有得到预期的结果,有人可以告诉我哪里做错了吗