Asserts that one string is like another.
Assert-Like [[-Haystack] <String>] [[-Needle] <String>] [[-Message] <String>] [<CommonParameters>]
Uses PowerShell's -like
operator, so simple wildcards are accepted.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Haystack | String | The string to look in. |
false | false | |
Needle | String | The string to look for. |
false | false | |
Message | String | The message to use when the assertion fails. |
false | false |
Assert-Like 'Haystack' '*stack*'
Demonstrates how to assert one string is like another. In this example, the assertion passes, becase 'Haystack' -like '*stack*'
.
Assert-Like 'Haystack' 'needle' 'Couldn''t find the needle in haystack!'
Demonstrates how to show a message when the assertion fails.