2020-03-24 11:08:37 -07:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
2018-02-13 09:23:53 -08:00
|
|
|
# Licensed under the MIT License.
|
2016-07-25 14:01:41 -07:00
|
|
|
Describe "Set-PSDebug" -Tags "CI" {
|
2016-05-12 13:50:46 -07:00
|
|
|
Context "Tracing can be used" {
|
|
|
|
|
AfterEach {
|
|
|
|
|
Set-PSDebug -Off
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-17 15:33:35 -05:00
|
|
|
It "Should be able to go through the tracing options" {
|
2018-03-23 10:36:11 -07:00
|
|
|
{ Set-PSDebug -Trace 0 } | Should -Not -Throw
|
|
|
|
|
{ Set-PSDebug -Trace 1 } | Should -Not -Throw
|
|
|
|
|
{ Set-PSDebug -Trace 2 } | Should -Not -Throw
|
2016-05-12 13:50:46 -07:00
|
|
|
}
|
|
|
|
|
|
2019-01-17 15:33:35 -05:00
|
|
|
It "Should be able to set strict" {
|
2018-03-23 10:36:11 -07:00
|
|
|
{ Set-PSDebug -Strict } | Should -Not -Throw
|
2016-05-12 13:50:46 -07:00
|
|
|
}
|
2025-07-16 03:42:09 +10:00
|
|
|
|
|
|
|
|
It "Should skip magic extents created by pwsh" {
|
|
|
|
|
class ClassWithDefaultCtor {
|
|
|
|
|
MyMethod() { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Set-PSDebug -Trace 1
|
|
|
|
|
[ClassWithDefaultCtor]::new()
|
|
|
|
|
} | Should -Not -Throw
|
|
|
|
|
}
|
2015-10-21 10:13:06 -07:00
|
|
|
}
|
|
|
|
|
}
|