diff --git a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 index 941998df8e2..02e52384fff 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 @@ -257,7 +257,6 @@ Describe 'Negative Parsing Tests' -Tags "CI" { ShouldBeParseError 'class foo {} class foo {}' MemberAlreadyDefined 13 ShouldBeParseError 'class foo { $x; $x; }' MemberAlreadyDefined 16 -SkipAndCheckRuntimeError ShouldBeParseError 'class foo { [int][string]$x; }' TooManyTypes 17 - ShouldBeParseError 'class foo { [int][string]$x; }' TooManyTypes 17 ShouldBeParseError 'class foo { static static $x; }' DuplicateQualifier 19 ShouldBeParseError 'class foo { [zz]$x; }' TypeNotFound 13 ShouldBeParseError 'class foo { [zz]f() { return 0 } }' TypeNotFound 13 @@ -286,11 +285,6 @@ Describe 'Negative Parsing Tests' -Tags "CI" { ShouldBeParseError 'class C { $x; static bar() { $this.x = 1 } }' NonStaticMemberAccessInStaticMember 29 ShouldBeParseError 'class C { $x; static $y = $this.x }' NonStaticMemberAccessInStaticMember 26 - ShouldBeParseError 'class C { $x; static bar() { $this.x = 1 } }' NonStaticMemberAccessInStaticMember 29 - ShouldBeParseError 'class C { $x; static $y = $this.x }' NonStaticMemberAccessInStaticMember 26 - ShouldBeParseError 'class C { $x; static bar() { $This.x = 1 } }' NonStaticMemberAccessInStaticMember 29 - ShouldBeParseError 'class C { $x; static $y = $This.x }' NonStaticMemberAccessInStaticMember 26 - ShouldBeParseError 'class C { [void]foo() { try { throw "foo"} finally { return } } }' ControlLeavingFinally 53 ShouldBeParseError 'class C { [int]foo() { return; return 1 } }' NonVoidMethodMissingReturnValue 23 ShouldBeParseError 'class C { [int]foo() { try { throw "foo"} catch { } } }' MethodHasCodePathNotReturn 15 @@ -371,20 +365,20 @@ Describe 'Negative ClassAttributes Tests' -Tags "CI" { [System.Management.Automation.Cmdlet("Get", "Thing")]class C{} $t = [C].GetCustomAttributes($false) - It "Should have one attribute" {$t.Count | should be 1} - It "Should have instance of CmdletAttribute" {$t[0].GetType().FullName | should be System.Management.Automation.CmdletAttribute } + It "Should have one attribute (class C)" {$t.Count | should be 1} + It "Should have instance of CmdletAttribute (class C)" {$t[0].GetType().FullName | should be System.Management.Automation.CmdletAttribute } [System.Management.Automation.CmdletAttribute]$c = $t[0] - It "Verb should be Get" {$c.VerbName | should be 'Get'} - It "Noun should be Thing" {$c.NounName | should be 'Thing'} + It "Verb should be Get (class C)" {$c.VerbName | should be 'Get'} + It "Noun should be Thing (class C)" {$c.NounName | should be 'Thing'} [System.Management.Automation.Cmdlet("Get", "Thing", SupportsShouldProcess = $true, SupportsPaging = $true)]class C2{} $t = [C2].GetCustomAttributes($false) - It "Should have one attribute" { $t.Count | should be 1 } - It "Should have instance of CmdletAttribute" { $t[0].GetType().FullName | should be System.Management.Automation.CmdletAttribute } + It "Should have one attribute (class C2)" { $t.Count | should be 1 } + It "Should have instance of CmdletAttribute (class C2)" { $t[0].GetType().FullName | should be System.Management.Automation.CmdletAttribute } [System.Management.Automation.CmdletAttribute]$c = $t[0] - It "Verb should be Get" {$c.VerbName | should be 'Get'} - It "Noun should be Thing" {$c.NounName | should be 'Thing'} + It "Verb should be Get (class C2)" {$c.VerbName | should be 'Get'} + It "Noun should be Thing (class C2)" {$c.NounName | should be 'Thing'} It "SupportsShouldProcess should be $true" { $c.ConfirmImpact | should be $true } It "SupportsPaging should be `$true" { $c.SupportsPaging | should be $true } @@ -433,7 +427,7 @@ Describe 'Positive SelfClass Type As Parameter Test' -Tags "CI" { Print() { Write-Host "[`$x=$($this.x) `$y=$($this.y)]" } Set($x, $y) { $this.x = $x; $this.y = $y } } - It "[Point]::Add works" { + It "[Point]::Add works construction via ::new" { $point = [Point]::new(100,200) $point2 = [Point]::new(1,2) $point.Add($point2) @@ -442,7 +436,7 @@ Describe 'Positive SelfClass Type As Parameter Test' -Tags "CI" { $point.y | should be 202 } - It "[Point]::Add works" { + It "[Point]::Add works construction via new-object" { $point = New-Object Point 100,200 $point2 = New-Object Point 1,2 $point.Add($point2) @@ -517,8 +511,8 @@ $ctorAssignments `$inst = [Foo]::new($methodArguments) `$sum = $addUpProperties - It "ExpectedTotal" { `$sum | should be $expectedTotal } - It "ExpectedTotal"{ `$inst.DoSomething($methodArguments) | should be $expectedTotal } + It "ExpectedTotal: Sum should be $expectedTotal" { `$sum | should be $expectedTotal } + It "ExpectedTotal: Invocation should return $expectedTotal" { `$inst.DoSomething($methodArguments) | should be $expectedTotal } "@ Invoke-Expression $class diff --git a/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 b/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 index 488de208b49..ee410b4ddb4 100644 --- a/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 +++ b/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 @@ -261,13 +261,13 @@ Describe "Unit tests for various script breakpoints" -Tags "CI" { { $actual = @(& $command) - It "Script breakpoint count" { + It "Script breakpoint count '${command}'|${expected}" { $actual.Count | Should Be $expected.Count } foreach ($breakpoint in $actual) { - It "Expected script breakpoints" { + It "Expected script breakpoints '${command}|${breakpoint}'" { ($expected -contains $breakpoint) | Should Be $true } } @@ -286,7 +286,7 @@ Describe "Unit tests for various script breakpoints" -Tags "CI" { } catch { - It "Script failed expected exception" { + It "Script failed expected exception '${command}'" { $_.Exception.GetType().Name | Should Be $exception } } diff --git a/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 b/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 index 2296feccc59..0255fa80acc 100644 --- a/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 +++ b/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 @@ -99,10 +99,10 @@ function ShouldBeParseError { $errorId = $err.ErrorId } - It "Error Id" { $errorId | Should Be $expectedErrors[$i] } + It "Error Id (iteration:$i)" { $errorId | Should Be $expectedErrors[$i] } $acutalPostion = $err.Extent.StartScriptPosition.Offset if ( $CheckColumnNumber ) { $acutalPostion = $err.Extent.StartScriptPosition.ColumnNumber } - It "Error position" -Pending:$SkipAndCheckRuntimeError { $acutalPostion | Should Be $expectedOffsets[$i] } + It "Error position (iteration:$i)" -Pending:$SkipAndCheckRuntimeError { $acutalPostion | Should Be $expectedOffsets[$i] } } } }