Skip to content

Remove extra newlines from formatting which resulted in necessary double newlines #8247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ private void ProcessGroupStart(FormatMessagesContextManager.OutputContext c)
ComplexWriter writer = new ComplexWriter();
writer.Initialize(_lo, _lo.ColumnNumber);
writer.WriteObject(goc.Data.groupingEntry.formatValueList);

this.LineOutput.WriteLine(string.Empty);
}
goc.GroupStart();
}
Expand All @@ -493,7 +491,6 @@ private void ProcessGroupEnd(GroupEndData ge, FormatMessagesContextManager.Outpu
GroupOutputContext goc = (GroupOutputContext)c;

goc.GroupEnd();
this.LineOutput.WriteLine(string.Empty);
}

/// <summary>
Expand Down Expand Up @@ -761,7 +758,7 @@ private void ProcessCachedGroupOnWide(WideViewHeaderInfo wvhi, List<PacketInfoDa
/// </summary>
static private int GetConsoleWindowWidth(int columnNumber)
{
if (InternalTestHooks.SetConsoleWidthToZero)
if (InternalTestHooks.SetConsoleWidthToZero)
{
return DefaultConsoleWidth;
}
Expand Down Expand Up @@ -1106,7 +1103,6 @@ internal static string[] GetValues(ListViewEntry lve)
/// </summary>
internal override void GroupStart()
{
this.InnerCommand._lo.WriteLine(string.Empty);
}

/// <summary>
Expand Down Expand Up @@ -1194,7 +1190,6 @@ internal override void Initialize()
/// </summary>
internal override void GroupStart()
{
this.InnerCommand._lo.WriteLine(string.Empty);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to this formatting code change, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Was running the tests locally and this line was outputting unncessarily

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ visibleX visibleY
10 12



"@

$tableOutput = $instance | Format-Table -AutoSize | Out-String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ gHeader
1 2 3



"@ },
@{ view = "Default"; widths = 4,7,4; variation = "4 row, 1 row, 2 row"; expectedTable = @"

Expand All @@ -350,7 +349,6 @@ er
1 2 3



"@ },
@{ view = "Default"; widths = 4,4,7; variation = "4 row, 2 row, 1 row"; expectedTable = @"

Expand All @@ -362,7 +360,6 @@ er
1 2 3



"@ },
@{ view = "Default"; widths = 14,7,3; variation = "1 row, 1 row, 3 row"; expectedTable = @"

Expand All @@ -373,7 +370,6 @@ LongLongHeader Header2 Hea
1 2 3



"@ },
@{ view = "One"; widths = 4,1,1; variation = "1 column"; expectedTable = @"

Expand All @@ -385,7 +381,6 @@ er
1



"@ }
) {
param($view, $widths, $expectedTable)
Expand Down Expand Up @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -588,7 +575,6 @@ er
45



"@ }
) {
param($view, $widths, $values, $wrap, $expectedTable)
Expand Down Expand Up @@ -690,7 +676,6 @@ abc bcd
1 1234



"@ },
@{ variation = "both columns"; obj = [pscustomobject]@{abc="1234";bcd="1234"},[pscustomobject]@{abc="1";bcd="1"}; expectedTable = @"

Expand All @@ -700,7 +685,6 @@ abc bcd
1 1



"@ },
@{ variation = "second column"; obj = [pscustomobject]@{abc="123";bcd="1234"},[pscustomobject]@{abc="1";bcd="123"}; expectedTable = @"

Expand All @@ -710,7 +694,6 @@ abc bcd
1 123



"@ }
) {
param($obj, $expectedTable)
Expand All @@ -726,7 +709,6 @@ a b
abc 123



"@ },
@{ variation = "left/left"; obj = [PSCustomObject]@{a="abc";b="abc"}; expectedTable = @"

Expand All @@ -735,7 +717,6 @@ a b
abc abc



"@ },
@{ variation = "right/left"; obj = [PSCustomObject]@{a=123;b="abc"}; expectedTable = @"

Expand All @@ -744,7 +725,6 @@ abc abc
123 abc



"@ },
@{ variation = "right/right"; obj = [PSCustomObject]@{a=123;b=123}; expectedTable = @"

Expand All @@ -753,7 +733,6 @@ abc abc
123 123



"@ }
) {
param($obj, $expectedTable)
Expand All @@ -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 = @"

Expand All @@ -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 = @"

Expand All @@ -793,7 +770,6 @@ A Name B
multiline content



"@ }
) {
param($obj, $expectedTable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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
Expand Down