diff --git a/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs b/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs index cd0c8fc4f..b556cb673 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs @@ -476,8 +476,6 @@ namespace Microsoft.PowerShell.Commands.Internal.Format ComplexWriter writer = new ComplexWriter(); writer.Initialize(_lo, _lo.ColumnNumber); writer.WriteObject(goc.Data.groupingEntry.formatValueList); - - this.LineOutput.WriteLine(string.Empty); } goc.GroupStart(); } @@ -493,7 +491,6 @@ namespace Microsoft.PowerShell.Commands.Internal.Format GroupOutputContext goc = (GroupOutputContext)c; goc.GroupEnd(); - this.LineOutput.WriteLine(string.Empty); } /// @@ -761,7 +758,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// static private int GetConsoleWindowWidth(int columnNumber) { - if (InternalTestHooks.SetConsoleWidthToZero) + if (InternalTestHooks.SetConsoleWidthToZero) { return DefaultConsoleWidth; } @@ -1106,7 +1103,6 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// internal override void GroupStart() { - this.InnerCommand._lo.WriteLine(string.Empty); } /// @@ -1194,7 +1190,6 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// internal override void GroupStart() { - this.InnerCommand._lo.WriteLine(string.Empty); } /// diff --git a/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 index c9a17bb54..c11a4f42b 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 @@ -401,7 +401,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" { Import-Module -Name $moduleFile -Force Test-ValidateSet 'Hello' | Should -BeExactly 'Hello' } finally { - Remove-Module -Name $moduleFile -Force + Remove-Module -Name $moduleFile -Force -ErrorAction SilentlyContinue } } } diff --git a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 index 83617bd25..381cab05b 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 @@ -589,7 +589,6 @@ visibleX visibleY 10 12 - "@ $tableOutput = $instance | Format-Table -AutoSize | Out-String diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 index 2578ccdd9..b7ec1b85f 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 @@ -399,16 +399,14 @@ Describe "Format-Custom with expression based EntrySelectedBy in a CustomControl Entry selected by property - Name ---- testing +'@ -replace '\r?\n', "^" -'@ -replace '\r?\n', [Environment]::NewLine - - $ps.Invoke() | Should -BeExactly $expectedOutput + $ps.Invoke() -replace '\r?\n', "^" | Should -BeExactly $expectedOutput $ps.Streams.Error | Should -BeNullOrEmpty } @@ -427,16 +425,14 @@ testing Entry selected by ScriptBlock - Name ---- SelectScriptBlock +'@ -replace '\r?\n', "^" -'@ -replace '\r?\n', [Environment]::NewLine - - $ps.Invoke() | Should -BeExactly $expectedOutput + $ps.Invoke() -replace '\r?\n', "^" | Should -BeExactly $expectedOutput $ps.Streams.Error | Should -BeNullOrEmpty } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-List.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-List.Tests.ps1 index ff3488693..415ef778a 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-List.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-List.Tests.ps1 @@ -23,7 +23,7 @@ Describe "Format-List" -Tags "CI" { } It "Should produce the expected output" { - $expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}" + $expected = "${nl}testName : testValue${nl}${nl}${nl}" $in = New-Object PSObject Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Table.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Table.Tests.ps1 index 60fcf791f..8bd478abb 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Table.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Table.Tests.ps1 @@ -338,7 +338,6 @@ gHeader 1 2 3 - "@ }, @{ view = "Default"; widths = 4,7,4; variation = "4 row, 1 row, 2 row"; expectedTable = @" @@ -350,7 +349,6 @@ er 1 2 3 - "@ }, @{ view = "Default"; widths = 4,4,7; variation = "4 row, 2 row, 1 row"; expectedTable = @" @@ -362,7 +360,6 @@ er 1 2 3 - "@ }, @{ view = "Default"; widths = 14,7,3; variation = "1 row, 1 row, 3 row"; expectedTable = @" @@ -373,7 +370,6 @@ LongLongHeader Header2 Hea 1 2 3 - "@ }, @{ view = "One"; widths = 4,1,1; variation = "1 column"; expectedTable = @" @@ -385,7 +381,6 @@ er 1 - "@ } ) { param($view, $widths, $expectedTable) @@ -487,7 +482,6 @@ er 1**********2***3 - "@ }, @{ view = "Default"; widths = 4,7,5; variation = "narrow values with wrap"; values = [PSCustomObject]@{First=1;Second=2;Third=3}; wrap = $true; expectedTable = @" @@ -499,7 +493,6 @@ er 1**********2*3 - "@ }, @{ view = "Default"; widths = 4,7,5; variation = "wide values"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $false; expectedTable = @" @@ -511,7 +504,6 @@ er 1...*...5678*12... - "@ }, @{ view = "One"; widths = 3,1,1; variation = "wide values, 1 column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $false; expectedTable = @" @@ -524,7 +516,6 @@ er 123 - "@ }, @{ view = "Default"; widths = 4,8,6; variation = "wide values with wrap, 1st column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" @@ -537,7 +528,6 @@ er 5 - "@ }, @{ view = "Default"; widths = 5,7,6; variation = "wide values with wrap, 2nd column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" @@ -549,7 +539,6 @@ ader ************8 - "@ }, @{ view = "Default"; widths = 5,8,5; variation = "wide values with wrap, 3rd column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" @@ -561,7 +550,6 @@ ader ***************6 - "@ }, @{ view = "Default"; widths = 4,7,5; variation = "wide values with wrap, all 3 columns"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" @@ -574,7 +562,6 @@ er 5**********8*6 - "@ }, @{ view = "One"; widths = 3,1,1; variation = "wide values with wrap, with 1 column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" @@ -588,7 +575,6 @@ er 45 - "@ } ) { param($view, $widths, $values, $wrap, $expectedTable) @@ -690,7 +676,6 @@ abc bcd 1 1234 - "@ }, @{ variation = "both columns"; obj = [pscustomobject]@{abc="1234";bcd="1234"},[pscustomobject]@{abc="1";bcd="1"}; expectedTable = @" @@ -700,7 +685,6 @@ abc bcd 1 1 - "@ }, @{ variation = "second column"; obj = [pscustomobject]@{abc="123";bcd="1234"},[pscustomobject]@{abc="1";bcd="123"}; expectedTable = @" @@ -710,7 +694,6 @@ abc bcd 1 123 - "@ } ) { param($obj, $expectedTable) @@ -726,7 +709,6 @@ a b abc 123 - "@ }, @{ variation = "left/left"; obj = [PSCustomObject]@{a="abc";b="abc"}; expectedTable = @" @@ -735,7 +717,6 @@ a b abc abc - "@ }, @{ variation = "right/left"; obj = [PSCustomObject]@{a=123;b="abc"}; expectedTable = @" @@ -744,7 +725,6 @@ abc abc 123 abc - "@ }, @{ variation = "right/right"; obj = [PSCustomObject]@{a=123;b=123}; expectedTable = @" @@ -753,7 +733,6 @@ abc abc 123 123 - "@ } ) { param($obj, $expectedTable) @@ -771,7 +750,6 @@ A B Name multiline content - "@ }, @{ variation = "left"; obj = [pscustomobject] @{Name="This`nIs some random`nmultiline content";A=1;B=2}; expectedTable = @" @@ -782,7 +760,6 @@ Is some random multiline content - "@ }, @{ variation = "middle"; obj = [pscustomobject] @{A=1;Name="This`nIs some random`nmultiline content";B=2}; expectedTable = @" @@ -793,7 +770,6 @@ A Name B multiline content - "@ } ) { param($obj, $expectedTable) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Out-File.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Out-File.Tests.ps1 index b438c30a3..0fc5dbcb0 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Out-File.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Out-File.Tests.ps1 @@ -83,12 +83,11 @@ Describe "Out-File" -Tags "CI" { $actual[3] | Should -Match "some test text" $actual[4] | Should -BeNullOrEmpty $actual[5] | Should -BeNullOrEmpty - $actual[6] | Should -BeNullOrEmpty - $actual[7] | Should -Match "text" - $actual[8] | Should -Match "----" - $actual[9] | Should -Match "some test text" + $actual[6] | Should -Match "text" + $actual[7] | Should -Match "----" + $actual[8] | Should -Match "some test text" + $actual[9] | Should -BeNullOrEmpty $actual[10] | Should -BeNullOrEmpty - $actual[11] | Should -BeNullOrEmpty } It "Should limit each line to the specified number of characters when the width switch is used on objects" { @@ -119,12 +118,11 @@ Describe "Out-File" -Tags "CI" { $actual[3] | Should -Match "some test text" $actual[4] | Should -BeNullOrEmpty $actual[5] | Should -BeNullOrEmpty - $actual[6] | Should -BeNullOrEmpty - $actual[7] | Should -Match "text" - $actual[8] | Should -Match "----" - $actual[9] | Should -Match "some test text" + $actual[6] | Should -Match "text" + $actual[7] | Should -Match "----" + $actual[8] | Should -Match "some test text" + $actual[9] | Should -BeNullOrEmpty $actual[10] | Should -BeNullOrEmpty - $actual[11] | Should -BeNullOrEmpty # reset to not read only so it can be deleted Set-ItemProperty -Path $testfile -Name IsReadOnly -Value $false