function Palindrome1
{
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[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
. "$here\Palindrome1.ps1"
Describe -Tags "Example" "Palindrome1" {
It "does something useful" {
Palindrome1 | Should Be $true
}
}