Functions/Assertions/Match.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Set-StrictMode -Version Latest

InModuleScope Pester {
    Describe "Match" {
        It "returns true for things that match" {
            'foobar' | Should Match 'ob'
            'foobar' | Should -Match 'ob'
        }

        It "returns false for things that do not match" {
            'foobar' | Should Not Match 'slime'
            'foobar' | Should -Not -Match 'slime'
        }

        It "passes for strings with different case" {
            'foobar' | Should Match 'FOOBAR'
            'foobar' | Should -Match 'FOOBAR'
        }

        It "uses regular expressions" {
            'foobar' | Should Match '\S{6}'
            'foobar' | Should -Match '\S{6}'
        }
    }
}