I have a dozen lines or so that need to be consistent across multiple .ps1 files. I was able to get this working using the -FileContentMatchMultiline functionality in Pester but I need the match to be case sensitive. Is there any simple way to do this?
Here is what I have currently:
It "Has all the lines below, but case sensitive" {
Get-ChildItem $directoryOfFilesToCheck | ForEach-Object {
$matchstring = @'
$var1 = Line one blah blah blah
$var2 = Line two blah blah blah
$var3 = Line three blah blah blah
'@
$_ | Should -FileContentMatchMultiline $([regex]::escape($matchString))
}
}
The problem is that it would also match if the files contained:
$var1 = Line one BLAH Blah blAH
$var2 = Line two BLAH Blah blAH
$var3 = Line three BLAH Blah blAH
This is important because in the file there are function calls that are case sensitive because they are used by a program running the script.