Functions/Assertions/MatchExactly.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
Set-StrictMode -Version Latest

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

        It "returns false for things that do not match exactly" {
            'foobar' | Should Not MatchExactly 'FOOBAR'
            'foobar' | Should -Not -MatchExactly 'FOOBAR'
            'foobar' | Should -Not -CMATCH 'FOOBAR'
        }

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