PowerShell/test/powershell/Set-PSBreakpoint.Tests.ps1

39 lines
1 KiB
PowerShell
Raw Normal View History

Describe "Set-PSBreakpoint" {
2015-12-28 20:05:48 +01:00
# Set up test script
$testScript = Join-Path -Path $PSScriptRoot -ChildPath psbreakpointtestscript.ps1
2015-12-28 20:05:48 +01:00
"`$var = 1 " > $testScript
It "Should be able to set a psbreakpoint on a line" {
$lineNumber = 1
$brk = Set-PSBreakpoint -Line $lineNumber -Script $testScript
$brk.Line | Should Be $lineNumber
Remove-PSBreakPoint -Id $brk.Id
2015-12-28 20:05:48 +01:00
}
It "Should throw when a string is entered for a line number" {
{
$lineNumber = "one"
Set-PSBreakpoint -Line $lineNumber -Script $testScript
2015-12-28 20:05:48 +01:00
} | Should Throw
2015-12-28 20:05:48 +01:00
}
It "Should be able to set a psbreakpoint on a Command" {
$command = "theCommand"
$brk = Set-PSBreakpoint -Command $command -Script $testScript
$brk.Command | Should Be $command
Remove-PSBreakPoint -Id $brk.Id
2015-12-28 20:05:48 +01:00
}
It "Should be able to set a psbreakpoint on a variable" {
$var = "theVariable"
$brk = Set-PSBreakpoint -Command $var -Script $testScript
$brk.Command | Should Be $var
Remove-PSBreakPoint -Id $brk.Id
2015-12-28 20:05:48 +01:00
}
# clean up after ourselves
Remove-Item -Path $testScript
2015-10-22 18:15:19 +02:00
}