Use correct casing for cmdlet name and cmdlet parameter name in *.ps1 files (#12584)

This commit is contained in:
xtqqczze
2020-05-07 17:00:30 +05:00
committed by GitHub
parent 71d8876e60
commit f4382202ae
230 changed files with 1315 additions and 1315 deletions
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe 'Basic debugger command tests' -tag 'CI' {
Describe 'Basic debugger command tests' -Tag 'CI' {
BeforeAll {
Register-DebuggerHandler
@@ -27,11 +27,11 @@ Describe 'Basic debugger command tests' -tag 'CI' {
$bp = Set-PSBreakpoint -Command Get-Process
Get-Process -Id $PID > $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
}
$results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue '?','h')
$results = @(Test-Debugger -Scriptblock $testScript -CommandQueue '?','h')
$result = @{
'?' = if ($results.Count -gt 0) {$results[0].Output -join [Environment]::NewLine}
'h' = if ($results.Count -gt 1) {$results[1].Output -join [Environment]::NewLine}
@@ -71,7 +71,7 @@ Describe 'Basic debugger command tests' -tag 'CI' {
$bp = Set-PSBreakpoint -Command Get-Process
Get-Process -Id $PID > $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
}
@@ -81,13 +81,13 @@ Describe 'Basic debugger command tests' -tag 'CI' {
3: $bp = Set-PSBreakpoint -Command Get-Process
4:* Get-Process -Id $PID > $null
5: } finally {
6: Remove-PSBreakPoint -Breakpoint $bp
6: Remove-PSBreakpoint -Breakpoint $bp
7: }
8:
'@
$testScriptList = NormalizeLineEnd -string $testScriptList
$results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'l','list')
$results = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'l','list')
$result = @{
'l' = if ($results.Count -gt 0) {$results[0].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"}
'list' = if ($results.Count -gt 1) {$results[1].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"}
@@ -120,21 +120,21 @@ Describe 'Basic debugger command tests' -tag 'CI' {
$bp = Set-PSBreakpoint -Command Get-Process
Get-Process -Id $PID > $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
}
$testScriptList = @'
4:* Get-Process -Id $PID > $null
5: } finally {
6: Remove-PSBreakPoint -Breakpoint $bp
6: Remove-PSBreakpoint -Breakpoint $bp
7: }
8:
'@
$testScriptList = NormalizeLineEnd -string $testScriptList
$results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'l 4','list 4')
$results = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'l 4','list 4')
$result = @{
'l 4' = if ($results.Count -gt 0) {$results[0].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"}
'list 4' = if ($results.Count -gt 1) {$results[1].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"}
@@ -167,7 +167,7 @@ Describe 'Basic debugger command tests' -tag 'CI' {
$bp = Set-PSBreakpoint -Command Get-Process
Get-Process -Id $PID > $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
}
@@ -178,7 +178,7 @@ Describe 'Basic debugger command tests' -tag 'CI' {
$testScriptList = NormalizeLineEnd -string $testScriptList
$results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'l 3 2','list 3 2')
$results = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'l 3 2','list 3 2')
$result = @{
'l 3 2' = if ($results.Count -gt 0) {$results[0].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"}
'list 3 2' = if ($results.Count -gt 1) {$results[1].Output -replace '\s+$' -join [Environment]::NewLine -replace "^[`r`n]+|[`r`n]+$"}
@@ -211,11 +211,11 @@ Describe 'Basic debugger command tests' -tag 'CI' {
$bp = Set-PSBreakpoint -Command Get-Process
Get-Process -Id $PID > $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
}
$results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'k','Get-PSCallStack')
$results = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'k','Get-PSCallStack')
$result = @{
'k' = if ($results.Count -gt 0) {$results[0].Output}
'Get-PSCallStack' = if ($results.Count -gt 1) {$results[1].Output}
@@ -238,7 +238,7 @@ Describe 'Basic debugger command tests' -tag 'CI' {
}
Describe 'Simple debugger stepping command tests' -tag 'CI' {
Describe 'Simple debugger stepping command tests' -Tag 'CI' {
BeforeAll {
Register-DebuggerHandler
@@ -258,13 +258,13 @@ Describe 'Simple debugger stepping command tests' -tag 'CI' {
'Red fish, blue fish'
} *> $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
}
$result = @{
's' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 's','s','s','s')
'stepInto' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'stepInto','stepInto','stepInto','stepInto')
's' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 's','s','s','s')
'stepInto' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'stepInto','stepInto','stepInto','stepInto')
}
}
@@ -311,13 +311,13 @@ Describe 'Simple debugger stepping command tests' -tag 'CI' {
Get-Date | ConvertTo-Csv
} *> $null
} finally {
Remove-PSBreakPoint -Breakpoint $bp1,$bp2
Remove-PSBreakpoint -Breakpoint $bp1,$bp2
}
}
$result = @{
'v' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'v','v','v','v')
'stepOver' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'stepOver','stepOver','stepOver','stepOver')
'v' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'v','v','v','v')
'stepOver' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'stepOver','stepOver','stepOver','stepOver')
}
}
@@ -362,13 +362,13 @@ Describe 'Simple debugger stepping command tests' -tag 'CI' {
$date = Get-Date
$date | ConvertTo-Csv
} finally {
Remove-PSBreakPoint -Breakpoint $bps
Remove-PSBreakpoint -Breakpoint $bps
}
}
$result = @{
'o' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'o','o','o')
'stepOut' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'stepOut','stepOut','stepOut')
'o' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'o','o','o')
'stepOut' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'stepOut','stepOut','stepOut')
}
}
@@ -398,7 +398,7 @@ Describe 'Simple debugger stepping command tests' -tag 'CI' {
}
}
Describe 'Debugger bug fix tests' -tag 'CI' {
Describe 'Debugger bug fix tests' -Tag 'CI' {
BeforeAll {
Register-DebuggerHandler
@@ -413,16 +413,16 @@ Describe 'Debugger bug fix tests' -tag 'CI' {
$testScript = {
function Test-Issue9824 {
$bp = Set-PSBreakpoint -Command Remove-PSBreakpoint
Remove-PSBreakPoint -Breakpoint $bp
Remove-PSBreakpoint -Breakpoint $bp
}
Test-Issue9824
1 + 1
}
$result = @{
's' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 's','s','s')
'v' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'v','v','v')
'o' = @(Test-Debugger -ScriptBlock $testScript -CommandQueue 'o','o')
's' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 's','s','s')
'v' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'v','v','v')
'o' = @(Test-Debugger -Scriptblock $testScript -CommandQueue 'o','o')
}
}
@@ -22,18 +22,18 @@ Describe "Breakpoints set on custom FileSystem provider files should work" -Tags
$scriptName = "DebuggerScriptTests-ExposeBug221362.ps1"
$scriptFullName = [io.path]::Combine($scriptPath, $scriptName)
write-output '"hello"' > $scriptFullName
Write-Output '"hello"' > $scriptFullName
#
# Create a file system provider
#
new-psdrive -name tmpTestA1 -psprovider FileSystem -root $scriptPath > $null
New-PSDrive -Name tmpTestA1 -PSProvider FileSystem -Root $scriptPath > $null
#
# Verify that the breakpoint is hit when using the provider
#
Push-Location tmpTestA1:\
$breakpoint = set-psbreakpoint .\$scriptName 1 -action { continue }
$breakpoint = Set-PSBreakpoint .\$scriptName 1 -Action { continue }
& .\$scriptName
It "Breakpoint hit count" {
@@ -44,7 +44,7 @@ Describe "Breakpoints set on custom FileSystem provider files should work" -Tags
{
Pop-Location
if ($null -ne $breakpoint) { $breakpoint | remove-psbreakpoint }
if ($null -ne $breakpoint) { $breakpoint | Remove-PSBreakpoint }
if (Test-Path $scriptFullName) { Remove-Item $scriptFullName -Force }
if ($null -ne (Get-PSDrive -Name tmpTestA1 2> $null)) { Remove-PSDrive -Name tmpTestA1 -Force }
}
@@ -64,7 +64,7 @@ Describe "Tests line breakpoints on dot-sourced files" -Tags "CI" {
#
$scriptFile = [io.path]::Combine([io.path]::GetTempPath(), "DebuggerScriptTests-ExposeBug245331.ps1")
write-output '
Write-Output '
function fibonacci
{
param($number)
@@ -89,7 +89,7 @@ Describe "Tests line breakpoints on dot-sourced files" -Tags "CI" {
#
# Set the breakpoint and verify it is hit
#
$breakpoint = Set-PsBreakpoint $scriptFile 17 -action { continue; }
$breakpoint = Set-PSBreakpoint $scriptFile 17 -Action { continue; }
& $scriptFile
@@ -99,7 +99,7 @@ Describe "Tests line breakpoints on dot-sourced files" -Tags "CI" {
}
finally
{
if ($null -ne $breakpoint) { $breakpoint | remove-psbreakpoint }
if ($null -ne $breakpoint) { $breakpoint | Remove-PSBreakpoint }
if (Test-Path $scriptFile) { Remove-Item -Path $scriptFile -Force }
}
}
@@ -123,7 +123,7 @@ Describe "Function calls clear debugger cache too early" -Tags "CI" {
#
$scriptFile = [io.path]::Combine([io.path]::GetTempPath(), "DebuggerScriptTests-ExposeBug248703.ps1")
write-output '
Write-Output '
function Hello
{
write-output "hello"
@@ -137,8 +137,8 @@ Describe "Function calls clear debugger cache too early" -Tags "CI" {
#
# Set the breakpoints and verify they are hit
#
$breakpoint1 = Set-PsBreakpoint $scriptFile 7 -action { continue; }
$breakpoint2 = Set-PsBreakpoint $scriptFile 9 -action { continue; }
$breakpoint1 = Set-PSBreakpoint $scriptFile 7 -Action { continue; }
$breakpoint2 = Set-PSBreakpoint $scriptFile 9 -Action { continue; }
& $scriptFile
@@ -152,8 +152,8 @@ Describe "Function calls clear debugger cache too early" -Tags "CI" {
}
finally
{
if ($null -ne $breakpoint1) { $breakpoint1 | remove-psbreakpoint }
if ($null -ne $breakpoint2) { $breakpoint2 | remove-psbreakpoint }
if ($null -ne $breakpoint1) { $breakpoint1 | Remove-PSBreakpoint }
if ($null -ne $breakpoint2) { $breakpoint2 | Remove-PSBreakpoint }
if (Test-Path $scriptFile) { Remove-Item $scriptFile -Force }
}
}
@@ -180,7 +180,7 @@ Describe "Line breakpoints on commands in multi-line pipelines" -Tags "CI" {
get-unique
'@
$breakpoints = Set-PsBreakpoint $script 1,2,3 -action { continue }
$breakpoints = Set-PSBreakpoint $script 1,2,3 -Action { continue }
$null = & $script
@@ -198,7 +198,7 @@ Describe "Line breakpoints on commands in multi-line pipelines" -Tags "CI" {
}
finally
{
if ($null -ne $breakpoints) { $breakpoints | remove-psbreakpoint }
if ($null -ne $breakpoints) { $breakpoints | Remove-PSBreakpoint }
if (Test-Path $script)
{
Remove-Item $script -Force
@@ -210,7 +210,7 @@ Describe "Line breakpoints on commands in multi-line pipelines" -Tags "CI" {
BeforeAll {
if ( $IsCoreCLR ) { return } # no COM on core
$scriptPath1 = Join-Path $TestDrive SBPShortPathBug133807.DRT.tmp.ps1
$scriptPath1 = setup -f SBPShortPathBug133807.DRT.tmp.ps1 -content '
$scriptPath1 = Setup -f SBPShortPathBug133807.DRT.tmp.ps1 -Content '
1..3 |
ForEach-Object { $_ } | sort-object |
get-unique'
@@ -218,7 +218,7 @@ Describe "Line breakpoints on commands in multi-line pipelines" -Tags "CI" {
$f = $a.GetFile($scriptPath1)
$scriptPath2 = $f.ShortPath
$breakpoints = Set-PsBreakpoint $scriptPath2 1,2,3 -action { continue }
$breakpoints = Set-PSBreakpoint $scriptPath2 1,2,3 -Action { continue }
$null = & $scriptPath2
}
@@ -227,15 +227,15 @@ Describe "Line breakpoints on commands in multi-line pipelines" -Tags "CI" {
if ($null -ne $breakpoints) { $breakpoints | Remove-PSBreakpoint }
}
It "Short path Breakpoint on line 1 hit count" -skip:$IsCoreCLR {
It "Short path Breakpoint on line 1 hit count" -Skip:$IsCoreCLR {
$breakpoints[0].HitCount | Should -Be 1
}
It "Short path Breakpoint on line 2 hit count" -skip:$IsCoreCLR {
It "Short path Breakpoint on line 2 hit count" -Skip:$IsCoreCLR {
$breakpoints[1].HitCount | Should -Be 3
}
It "Short path Breakpoint on line 3 hit count" -skip:$IsCoreCLR {
It "Short path Breakpoint on line 3 hit count" -Skip:$IsCoreCLR {
$breakpoints[2].HitCount | Should -Be 1
}
}
@@ -251,7 +251,7 @@ Describe "Unit tests for various script breakpoints" -Tags "CI" {
if ($null -eq $path)
{
$path = split-path $MyInvocation.InvocationName
$path = Split-Path $MyInvocation.InvocationName
}
#
@@ -290,7 +290,7 @@ Describe "Unit tests for various script breakpoints" -Tags "CI" {
#
# Ensure there are no breakpoints at start of test
#
Get-PsBreakpoint | Remove-PsBreakpoint
Get-PSBreakpoint | Remove-PSBreakpoint
#
# Create a couple of scripts
@@ -298,54 +298,54 @@ Describe "Unit tests for various script breakpoints" -Tags "CI" {
$scriptFile1 = [io.path]::Combine([io.path]::GetTempPath(), "DebuggerScriptTests-Get-PsBreakpoint1.ps1")
$scriptFile2 = [io.path]::Combine([io.path]::GetTempPath(), "DebuggerScriptTests-Get-PsBreakpoint2.ps1")
write-output '' > $scriptFile1
write-output '' > $scriptFile2
Write-Output '' > $scriptFile1
Write-Output '' > $scriptFile2
#
# Set several breakpoints of different types
#
$line1 = Set-PsBreakpoint $scriptFile1 1
$line2 = Set-PsBreakpoint $scriptFile2 2
$line1 = Set-PSBreakpoint $scriptFile1 1
$line2 = Set-PSBreakpoint $scriptFile2 2
$cmd1 = Set-PsBreakpoint -c command1 -s $scriptFile1
$cmd2 = Set-PsBreakpoint -c command2 -s $scriptFile2
$cmd3 = Set-PsBreakpoint -c command3
$cmd1 = Set-PSBreakpoint -c command1 -s $scriptFile1
$cmd2 = Set-PSBreakpoint -c command2 -s $scriptFile2
$cmd3 = Set-PSBreakpoint -c command3
$var1 = Set-PsBreakpoint -v variable1 -s $scriptFile1
$var2 = Set-PsBreakpoint -v variable2 -s $scriptFile2
$var3 = Set-PsBreakpoint -v variable3
$var1 = Set-PSBreakpoint -v variable1 -s $scriptFile1
$var2 = Set-PSBreakpoint -v variable2 -s $scriptFile2
$var3 = Set-PSBreakpoint -v variable3
#
# The default parameter set must return all breakpoints
#
Verify { get-psbreakpoint } $line1,$line2,$cmd1,$cmd2,$cmd3,$var1,$var2,$var3
Verify { Get-PSBreakpoint } $line1,$line2,$cmd1,$cmd2,$cmd3,$var1,$var2,$var3
#
# Query by ID
#
Verify { get-psbreakpoint -id $line1.ID,$cmd1.ID,$var1.ID } $line1,$cmd1,$var1 # -id
Verify { get-psbreakpoint $line2.ID,$cmd2.ID,$var2.ID } $line2,$cmd2,$var2 # positional
Verify { $cmd3.ID,$var3.ID | get-psbreakpoint } $cmd3,$var3 # value from pipeline
Verify { Get-PSBreakpoint -Id $line1.ID,$cmd1.ID,$var1.ID } $line1,$cmd1,$var1 # -id
Verify { Get-PSBreakpoint $line2.ID,$cmd2.ID,$var2.ID } $line2,$cmd2,$var2 # positional
Verify { $cmd3.ID,$var3.ID | Get-PSBreakpoint } $cmd3,$var3 # value from pipeline
VerifyException { get-psbreakpoint -id $null } "ParameterBindingValidationException"
VerifyException { get-psbreakpoint -id $line1.ID -script $scriptFile1 } "ParameterBindingException"
VerifyException { Get-PSBreakpoint -Id $null } "ParameterBindingValidationException"
VerifyException { Get-PSBreakpoint -Id $line1.ID -Script $scriptFile1 } "ParameterBindingException"
#
# Query by Script
#
Verify { get-psbreakpoint -script $scriptFile1 } $line1,$cmd1,$var1 # -script
Verify { get-psbreakpoint $scriptFile2 } $line2,$cmd2,$var2 # positional
Verify { $scriptFile2 | get-psbreakpoint } $line2,$cmd2,$var2 # value from pipeline
Verify { Get-PSBreakpoint -Script $scriptFile1 } $line1,$cmd1,$var1 # -script
Verify { Get-PSBreakpoint $scriptFile2 } $line2,$cmd2,$var2 # positional
Verify { $scriptFile2 | Get-PSBreakpoint } $line2,$cmd2,$var2 # value from pipeline
VerifyException { get-psbreakpoint -script $null } "ParameterBindingValidationException"
VerifyException { get-psbreakpoint -script $scriptFile1,$null } "ParameterBindingValidationException"
VerifyException { Get-PSBreakpoint -Script $null } "ParameterBindingValidationException"
VerifyException { Get-PSBreakpoint -Script $scriptFile1,$null } "ParameterBindingValidationException"
# Verify that relative paths are handled correctly
$directoryName = [System.IO.Path]::GetDirectoryName($scriptFile1)
$fileName = [System.IO.Path]::GetFileName($scriptFile1)
Push-Location $directoryName
Verify { get-psbreakpoint -script $fileName } $line1,$cmd1,$var1
Verify { Get-PSBreakpoint -Script $fileName } $line1,$cmd1,$var1
Pop-Location
#
@@ -354,28 +354,28 @@ Describe "Unit tests for various script breakpoints" -Tags "CI" {
$commandType = [Microsoft.PowerShell.Commands.BreakpointType]"command"
$variableType = [Microsoft.PowerShell.Commands.BreakpointType]"variable"
Verify { get-psbreakpoint -type "line" } $line1,$line2 # -type
Verify { get-psbreakpoint $commandType } $cmd1,$cmd2,$cmd3 # positional
Verify { $variableType | get-psbreakpoint } $var1,$var2,$var3 # value from pipeline
Verify { get-psbreakpoint -type "line" -script $scriptFile1 } @($line1) # -script parameter
Verify { Get-PSBreakpoint -Type "line" } $line1,$line2 # -type
Verify { Get-PSBreakpoint $commandType } $cmd1,$cmd2,$cmd3 # positional
Verify { $variableType | Get-PSBreakpoint } $var1,$var2,$var3 # value from pipeline
Verify { Get-PSBreakpoint -Type "line" -Script $scriptFile1 } @($line1) # -script parameter
VerifyException { get-psbreakpoint -type $null } "ParameterBindingValidationException"
VerifyException { Get-PSBreakpoint -Type $null } "ParameterBindingValidationException"
#
# Query by Command
#
Verify { get-psbreakpoint -command "command1","command2" } $cmd1,$cmd2 # -command
Verify { get-psbreakpoint -command "command1","command2" -script $scriptFile1 } @($cmd1) # -script parameter
Verify { Get-PSBreakpoint -Command "command1","command2" } $cmd1,$cmd2 # -command
Verify { Get-PSBreakpoint -Command "command1","command2" -Script $scriptFile1 } @($cmd1) # -script parameter
VerifyException { get-psbreakpoint -command $null } "ParameterBindingValidationException"
VerifyException { Get-PSBreakpoint -Command $null } "ParameterBindingValidationException"
#
# Query by Variable
#
Verify { get-psbreakpoint -variable "variable1","variable2" } $var1,$var2 # -command
Verify { get-psbreakpoint -variable "variable1","variable2" -script $scriptFile1 } @($var1) # -script parameter
Verify { Get-PSBreakpoint -Variable "variable1","variable2" } $var1,$var2 # -command
Verify { Get-PSBreakpoint -Variable "variable1","variable2" -Script $scriptFile1 } @($var1) # -script parameter
VerifyException { get-psbreakpoint -variable $null } "ParameterBindingValidationException"
VerifyException { Get-PSBreakpoint -Variable $null } "ParameterBindingValidationException"
}
finally
{
@@ -404,7 +404,7 @@ Describe "Unit tests for line breakpoints on dot-sourced files" -Tags "CI" {
if ($null -eq $path)
{
$path = split-path $MyInvocation.InvocationName
$path = Split-Path $MyInvocation.InvocationName
}
try
@@ -414,7 +414,7 @@ Describe "Unit tests for line breakpoints on dot-sourced files" -Tags "CI" {
#
$scriptFile = [io.path]::Combine([io.path]::GetTempPath(), "DebuggerScriptTests-InMemoryBreakpoints.ps1")
write-output '
Write-Output '
function Function1
{
write-host "In Function1" # line 4
@@ -450,9 +450,9 @@ Describe "Unit tests for line breakpoints on dot-sourced files" -Tags "CI" {
#
# Set a couple of line breakpoints on the file, dot-source it and verify that the breakpoints are hit
#
$breakpoint1 = Set-PsBreakpoint $scriptFile 4 -action { continue; }
$breakpoint2 = Set-PsBreakpoint $scriptFile 9 -action { continue; }
$breakpoint3 = Set-PsBreakpoint $scriptFile 24 -action { continue; }
$breakpoint1 = Set-PSBreakpoint $scriptFile 4 -Action { continue; }
$breakpoint2 = Set-PSBreakpoint $scriptFile 9 -Action { continue; }
$breakpoint3 = Set-PSBreakpoint $scriptFile 24 -Action { continue; }
. $scriptFile
@@ -500,7 +500,7 @@ Describe "Unit tests for line breakpoints on modules" -Tags "CI" {
New-Item -ItemType Directory $moduleDirectory 2> $null
write-output '
Write-Output '
function ModuleFunction1
{
write-output "In ModuleFunction1" # line 4
@@ -542,15 +542,15 @@ Describe "Unit tests for line breakpoints on modules" -Tags "CI" {
#
$ENV:PSModulePath = $moduleRoot
import-module $moduleName
Import-Module $moduleName
#
# Set a couple of line breakpoints on the module and verify that they are hit
#
$breakpoint1 = Set-PsBreakpoint $moduleFile 4 -action { continue }
$breakpoint2 = Set-PsBreakpoint $moduleFile 9 -action { continue }
$breakpoint3 = Set-PsBreakpoint $moduleFile 24 -Action { continue }
$breakpoint4 = Set-PsBreakpoint $moduleFile 25 -Action { continue }
$breakpoint1 = Set-PSBreakpoint $moduleFile 4 -Action { continue }
$breakpoint2 = Set-PSBreakpoint $moduleFile 9 -Action { continue }
$breakpoint3 = Set-PSBreakpoint $moduleFile 24 -Action { continue }
$breakpoint4 = Set-PSBreakpoint $moduleFile 25 -Action { continue }
ModuleFunction1
@@ -579,8 +579,8 @@ Describe "Unit tests for line breakpoints on modules" -Tags "CI" {
if ($null -ne $breakpoint2) { Remove-PSBreakpoint $breakpoint2 }
if ($null -ne $breakpoint3) { Remove-PSBreakpoint $breakpoint3 }
if ($null -ne $breakpoint4) { Remove-PSBreakpoint $breakpoint4 }
get-module $moduleName | remove-module
if (Test-Path $moduleDirectory) { Remove-Item $moduleDirectory -Recurse -force -ErrorAction silentlycontinue }
Get-Module $moduleName | Remove-Module
if (Test-Path $moduleDirectory) { Remove-Item $moduleDirectory -Recurse -Force -ErrorAction silentlycontinue }
}
}
@@ -639,7 +639,7 @@ Describe "Sometimes line breakpoints are ignored" -Tags "CI" {
if ($null -ne $bp1) { Remove-PSBreakpoint $bp1 }
if ($null -ne $bp2) { Remove-PSBreakpoint $bp2 }
if (Test-Path -Path $tempFileName1) { Remove-Item $tempFileName1 -force }
if (Test-Path -Path $tempFileName2) { Remove-Item $tempFileName2 -force }
if (Test-Path -Path $tempFileName1) { Remove-Item $tempFileName1 -Force }
if (Test-Path -Path $tempFileName2) { Remove-Item $tempFileName2 -Force }
}
}
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe 'Basic debugger tests' -tag 'CI' {
Describe 'Basic debugger tests' -Tag 'CI' {
BeforeAll {
Register-DebuggerHandler
@@ -17,7 +17,7 @@ Describe 'Basic debugger tests' -tag 'CI' {
function Test-DollarQuestionMark {
[CmdletBinding()]
param()
Get-Process -id ([int]::MaxValue)
Get-Process -Id ([int]::MaxValue)
if (-not $?) {
'The value of $? was preserved during debugging.'
} else {
@@ -27,7 +27,7 @@ Describe 'Basic debugger tests' -tag 'CI' {
$global:DollarQuestionMarkResults = Test-DollarQuestionMark -ErrorAction Break
}
$global:results = @(Test-Debugger -ScriptBlock $testScript -CommandQueue '$?')
$global:results = @(Test-Debugger -Scriptblock $testScript -CommandQueue '$?')
}
AfterAll {
@@ -51,7 +51,7 @@ Describe 'Basic debugger tests' -tag 'CI' {
}
}
Describe "Breakpoints when set should be hit" -tag "CI" {
Describe "Breakpoints when set should be hit" -Tag "CI" {
Context "Basic tests" {
BeforeAll {
$script = @'
@@ -63,11 +63,11 @@ Describe "Breakpoints when set should be hit" -tag "CI" {
'bbb'
'@
$path = Setup -PassThru -File BasicTest.ps1 -Content $script
$bps = 1..6 | ForEach-Object { set-psbreakpoint -script $path -line $_ -Action { continue } }
$bps = 1..6 | ForEach-Object { Set-PSBreakpoint -Script $path -Line $_ -Action { continue } }
}
AfterAll {
$bps | Remove-PSBreakPoint
$bps | Remove-PSBreakpoint
}
It "A redirected breakpoint is hit" {
@@ -333,7 +333,7 @@ elseif (Test-Path $PSCommandPath)
}
}
Describe "It should be possible to reset runspace debugging" -tag "Feature" {
Describe "It should be possible to reset runspace debugging" -Tag "Feature" {
BeforeAll {
$script = @'
"line 1"
@@ -3,7 +3,7 @@
Describe "Tests Debugger GetCallStack() on runspaces when attached to a WinRM host process" -Tags "CI" {
It -skip "Disabled test because it is fragile and does not consistently succeed on test VMs" { }
It -Skip "Disabled test because it is fragile and does not consistently succeed on test VMs" { }
return
try