diff --git a/en-US/about_Should.help.txt b/en-US/about_Should.help.txt index 104b34559..29654fa34 100644 --- a/en-US/about_Should.help.txt +++ b/en-US/about_Should.help.txt @@ -168,6 +168,22 @@ SHOULD MEMBERS 'TestDrive:\file.txt' | Should -FileContentMatch 'I am' # Test will pass 'TestDrive:\file.txt' | Should -FileContentMatch 'I Am' # Test will fail + FileContentMatchMultiline + As opposed to FileContentMatch and FileContentMatchExactly operators, FileContentMatchMultiline presents content of the file + being tested as one string object, so that the expression you are comparing it to can consist of several lines. + + $Content = "I am the first line.`nI am the second line." + Set-Content -Path TestDrive:\file.txt -Value $Content -NoNewline + 'TestDrive:\file.txt' | Should -FileContentMatchMultiline 'first line\.\r?\nI am' # Test will pass + 'TestDrive:\file.txt' | Should -FileContentMatchMultiline '^I am the first.*\n.*second line\.$' # Test will pass. + + When using FileContentMatchMultiline operator, '^' and '$' represent the beginning and end of the whole file, + instead of the beginning and end of a line. + + $Content = "I am the first line.`nI am the second line." + Set-Content -Path TestDrive:\file.txt -Value $Content -NoNewline + 'TestDrive:\file.txt' | Should -FileContentMatchMultiline '^I am the first line\.$' # Test will fail. + EXCEPTIONS Throw