< Back
Assert-Like
Post
NAME Assert-Like
SYNOPSIS
Asserts that one string is like another.
SYNTAX
Assert-Like [[-Haystack] <String>] [[-Needle] <String>] [[-Message] <String>] [<CommonParameters>]
DESCRIPTION
Uses PowerShell's `-like` operator, so simple wildcards are accepted.
PARAMETERS
-Haystack <String>
The string to look in.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Needle <String>
The string to look for.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
The message to use when the assertion fails.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Assert-Like 'Haystack' '*stack*'
Demonstrates how to assert one string is like another. In this example, the assertion passes, becase `'Haystack'
-like '*stack*'`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-Like 'Haystack' 'needle' 'Couldn''t find the needle in haystack!'
Demonstrates how to show a message when the assertion fails.
RELATED LINKS
about_comparison_operators
SYNOPSIS
Asserts that one string is like another.
SYNTAX
Assert-Like [[-Haystack] <String>] [[-Needle] <String>] [[-Message] <String>] [<CommonParameters>]
DESCRIPTION
Uses PowerShell's `-like` operator, so simple wildcards are accepted.
PARAMETERS
-Haystack <String>
The string to look in.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Needle <String>
The string to look for.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Message <String>
The message to use when the assertion fails.
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Assert-Like 'Haystack' '*stack*'
Demonstrates how to assert one string is like another. In this example, the assertion passes, becase `'Haystack'
-like '*stack*'`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Assert-Like 'Haystack' 'needle' 'Couldn''t find the needle in haystack!'
Demonstrates how to show a message when the assertion fails.
RELATED LINKS
about_comparison_operators