From 0f2533d85b881f5ce8ad93eea3491b267942925d Mon Sep 17 00:00:00 2001 From: James Truher Date: Fri, 23 Mar 2018 20:46:19 -0700 Subject: [PATCH] Make sure that the width of the header is at least the size of the label (or propertyname) --- .../DefaultFormatters/DotNetTypes_format_ps1xml.cs | 2 +- test/powershell/engine/Basic/SemanticVersion.Tests.ps1 | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/DotNetTypes_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/DotNetTypes_format_ps1xml.cs index 7e083ef66d9..b5deb6b4892 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/DotNetTypes_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/DotNetTypes_format_ps1xml.cs @@ -512,7 +512,7 @@ private static IEnumerable ViewsOf_Semantic_Version_With_L .AddHeader(width: 6) .AddHeader(width: 6) .AddHeader(width: 6) - .AddHeader(width: 9) + .AddHeader(width: 15) .AddHeader(width: 11) .StartRowDefinition() .AddPropertyColumn("Major") diff --git a/test/powershell/engine/Basic/SemanticVersion.Tests.ps1 b/test/powershell/engine/Basic/SemanticVersion.Tests.ps1 index 0d5f3d3fbd6..55a2d2ab6eb 100644 --- a/test/powershell/engine/Basic/SemanticVersion.Tests.ps1 +++ b/test/powershell/engine/Basic/SemanticVersion.Tests.ps1 @@ -245,4 +245,10 @@ Describe "SemanticVersion api tests" -Tags 'CI' { $des.ToString() | Should -Be $expectedResult } } + + Context "Formatting" { + It "Should not throw when default format-table is used" { + { $PSVersionTable.PSVersion | Format-Table | Out-String } | Should -Not -Throw + } + } }