GeezerVison is showing github.com — [feature] · PowerShell/PowerShell@49f7c17
File treeExpand file treeCollapse file tree Open diff view settings src/System.Management.Automation/FormatAndOutput/common Modules/Microsoft.PowerShell.Utility
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs +1-6Lines changed: 1 addition & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -476,8 +476,6 @@ private void ProcessGroupStart(FormatMessagesContextManager.OutputContext c) | 476 | 476 | ComplexWriter writer = new ComplexWriter(); | 477 | 477 | writer.Initialize(_lo, _lo.ColumnNumber); | 478 | 478 | writer.WriteObject(goc.Data.groupingEntry.formatValueList); | 479 | | - | 480 | | - this.LineOutput.WriteLine(string.Empty); | 481 | 479 | } | 482 | 480 | goc.GroupStart(); | 483 | 481 | } | @@ -493,7 +491,6 @@ private void ProcessGroupEnd(GroupEndData ge, FormatMessagesContextManager.Outpu | 493 | 491 | GroupOutputContext goc = (GroupOutputContext)c; | 494 | 492 |
| 495 | 493 | goc.GroupEnd(); | 496 | | - this.LineOutput.WriteLine(string.Empty); | 497 | 494 | } | 498 | 495 |
| 499 | 496 | /// <summary> | @@ -761,7 +758,7 @@ private void ProcessCachedGroupOnWide(WideViewHeaderInfo wvhi, List<PacketInfoDa | 761 | 758 | /// </summary> | 762 | 759 | static private int GetConsoleWindowWidth(int columnNumber) | 763 | 760 | { | 764 | | - if (InternalTestHooks.SetConsoleWidthToZero) | | 761 | + if (InternalTestHooks.SetConsoleWidthToZero) | 765 | 762 | { | 766 | 763 | return DefaultConsoleWidth; | 767 | 764 | } | @@ -1106,7 +1103,6 @@ internal static string[] GetValues(ListViewEntry lve) | 1106 | 1103 | /// </summary> | 1107 | 1104 | internal override void GroupStart() | 1108 | 1105 | { | 1109 | | - this.InnerCommand._lo.WriteLine(string.Empty); | 1110 | 1106 | } | 1111 | 1107 |
| 1112 | 1108 | /// <summary> | @@ -1194,7 +1190,6 @@ internal override void Initialize() | 1194 | 1190 | /// </summary> | 1195 | 1191 | internal override void GroupStart() | 1196 | 1192 | { | 1197 | | - this.InnerCommand._lo.WriteLine(string.Empty); | 1198 | 1193 | } | 1199 | 1194 |
| 1200 | 1195 | /// <summary> | |
Collapse file Copy file name to clipboardExpand all lines: test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1 +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -401,7 +401,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" { | 401 | 401 | Import-Module -Name $moduleFile -Force | 402 | 402 | Test-ValidateSet 'Hello' | Should -BeExactly 'Hello' | 403 | 403 | } finally { | 404 | | - Remove-Module -Name $moduleFile -Force | | 404 | + Remove-Module -Name $moduleFile -Force -ErrorAction SilentlyContinue | 405 | 405 | } | 406 | 406 | } | 407 | 407 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -589,7 +589,6 @@ visibleX visibleY | 589 | 589 | 10 12 | 590 | 590 |
| 591 | 591 |
| 592 | | -
| 593 | 592 | "@ | 594 | 593 |
| 595 | 594 | $tableOutput = $instance | Format-Table -AutoSize | Out-String | |
Collapse file Copy file name to clipboardExpand all lines: test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Custom.Tests.ps1 +4-8Lines changed: 4 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -399,16 +399,14 @@ Describe "Format-Custom with expression based EntrySelectedBy in a CustomControl | 399 | 399 |
| 400 | 400 |
| 401 | 401 | Entry selected by property | 402 | | -
| 403 | 402 | Name | 404 | 403 | ---- | 405 | 404 | testing | 406 | 405 |
| 407 | 406 |
| | 407 | +'@ -replace '\r?\n', "^" | 408 | 408 |
| 409 | | -'@ -replace '\r?\n', [Environment]::NewLine | 410 | | - | 411 | | - $ps.Invoke() | Should -BeExactly $expectedOutput | | 409 | + $ps.Invoke() -replace '\r?\n', "^" | Should -BeExactly $expectedOutput | 412 | 410 | $ps.Streams.Error | Should -BeNullOrEmpty | 413 | 411 | } | 414 | 412 |
| @@ -427,16 +425,14 @@ testing | 427 | 425 |
| 428 | 426 |
| 429 | 427 | Entry selected by ScriptBlock | 430 | | -
| 431 | 428 | Name | 432 | 429 | ---- | 433 | 430 | SelectScriptBlock | 434 | 431 |
| 435 | 432 |
| | 433 | +'@ -replace '\r?\n', "^" | 436 | 434 |
| 437 | | -'@ -replace '\r?\n', [Environment]::NewLine | 438 | | - | 439 | | - $ps.Invoke() | Should -BeExactly $expectedOutput | | 435 | + $ps.Invoke() -replace '\r?\n', "^" | Should -BeExactly $expectedOutput | 440 | 436 | $ps.Streams.Error | Should -BeNullOrEmpty | 441 | 437 | } | 442 | 438 | } |
Collapse file Copy file name to clipboardExpand all lines: test/powershell/Modules/Microsoft.PowerShell.Utility/Format-List.Tests.ps1 +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,7 @@ Describe "Format-List" -Tags "CI" { | 23 | 23 | } | 24 | 24 |
| 25 | 25 | It "Should produce the expected output" { | 26 | | - $expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}" | | 26 | + $expected = "${nl}testName : testValue${nl}${nl}${nl}" | 27 | 27 | $in = New-Object PSObject | 28 | 28 | Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue | 29 | 29 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Table.Tests.ps1 -24Lines changed: 0 additions & 24 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -338,7 +338,6 @@ gHeader | 338 | 338 | 1 2 3 | 339 | 339 |
| 340 | 340 |
| 341 | | -
| 342 | 341 | "@ }, | 343 | 342 | @{ view = "Default"; widths = 4,7,4; variation = "4 row, 1 row, 2 row"; expectedTable = @" | 344 | 343 |
| | 350 | 349 | 1 2 3 | 351 | 350 |
| 352 | 351 |
| 353 | | -
| 354 | 352 | "@ }, | 355 | 353 | @{ view = "Default"; widths = 4,4,7; variation = "4 row, 2 row, 1 row"; expectedTable = @" | 356 | 354 |
| | 362 | 360 | 1 2 3 | 363 | 361 |
| 364 | 362 |
| 365 | | -
| 366 | 363 | "@ }, | 367 | 364 | @{ view = "Default"; widths = 14,7,3; variation = "1 row, 1 row, 3 row"; expectedTable = @" | 368 | 365 |
| @@ -373,7 +370,6 @@ LongLongHeader Header2 Hea | 373 | 370 | 1 2 3 | 374 | 371 |
| 375 | 372 |
| 376 | | -
| 377 | 373 | "@ }, | 378 | 374 | @{ view = "One"; widths = 4,1,1; variation = "1 column"; expectedTable = @" | 379 | 375 |
| | 385 | 381 | 1 | 386 | 382 |
| 387 | 383 |
| 388 | | -
| 389 | 384 | "@ } | 390 | 385 | ) { | 391 | 386 | param($view, $widths, $expectedTable) | | 487 | 482 | 1**********2***3 | 488 | 483 |
| 489 | 484 |
| 490 | | -
| 491 | 485 | "@ }, | 492 | 486 | @{ view = "Default"; widths = 4,7,5; variation = "narrow values with wrap"; values = [PSCustomObject]@{First=1;Second=2;Third=3}; wrap = $true; expectedTable = @" | 493 | 487 |
| | 499 | 493 | 1**********2*3 | 500 | 494 |
| 501 | 495 |
| 502 | | -
| 503 | 496 | "@ }, | 504 | 497 | @{ view = "Default"; widths = 4,7,5; variation = "wide values"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $false; expectedTable = @" | 505 | 498 |
| | 511 | 504 | 1...*...5678*12... | 512 | 505 |
| 513 | 506 |
| 514 | | -
| 515 | 507 | "@ }, | 516 | 508 | @{ view = "One"; widths = 3,1,1; variation = "wide values, 1 column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $false; expectedTable = @" | 517 | 509 |
| | 524 | 516 | 123 | 525 | 517 |
| 526 | 518 |
| 527 | | -
| 528 | 519 | "@ }, | 529 | 520 | @{ view = "Default"; widths = 4,8,6; variation = "wide values with wrap, 1st column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" | 530 | 521 |
| | 537 | 528 | 5 | 538 | 529 |
| 539 | 530 |
| 540 | | -
| 541 | 531 | "@ }, | 542 | 532 | @{ view = "Default"; widths = 5,7,6; variation = "wide values with wrap, 2nd column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" | 543 | 533 |
| | 549 | 539 | ************8 | 550 | 540 |
| 551 | 541 |
| 552 | | -
| 553 | 542 | "@ }, | 554 | 543 | @{ view = "Default"; widths = 5,8,5; variation = "wide values with wrap, 3rd column"; values = [PSCustomObject]@{First="12345";Second="12345678";Third="123456"}; wrap = $true; expectedTable = @" | 555 | 544 |
| | 561 | 550 | ***************6 | 562 | 551 |
| 563 | 552 |
| 564 | | -
| 565 | 553 | "@ }, | 566 | 554 | @{ 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 = @" | 567 | 555 |
| | 574 | 562 | 5**********8*6 | 575 | 563 |
| 576 | 564 |
| 577 | | -
| 578 | 565 | "@ }, | 579 | 566 | @{ 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 = @" | 580 | 567 |
| | 588 | 575 | 45 | 589 | 576 |
| 590 | 577 |
| 591 | | -
| 592 | 578 | "@ } | 593 | 579 | ) { | 594 | 580 | param($view, $widths, $values, $wrap, $expectedTable) | @@ -690,7 +676,6 @@ abc bcd | 690 | 676 | 1 1234 | 691 | 677 |
| 692 | 678 |
| 693 | | -
| 694 | 679 | "@ }, | 695 | 680 | @{ variation = "both columns"; obj = [pscustomobject]@{abc="1234";bcd="1234"},[pscustomobject]@{abc="1";bcd="1"}; expectedTable = @" | 696 | 681 |
| @@ -700,7 +685,6 @@ abc bcd | 700 | 685 | 1 1 | 701 | 686 |
| 702 | 687 |
| 703 | | -
| 704 | 688 | "@ }, | 705 | 689 | @{ variation = "second column"; obj = [pscustomobject]@{abc="123";bcd="1234"},[pscustomobject]@{abc="1";bcd="123"}; expectedTable = @" | 706 | 690 |
| @@ -710,7 +694,6 @@ abc bcd | 710 | 694 | 1 123 | 711 | 695 |
| 712 | 696 |
| 713 | | -
| 714 | 697 | "@ } | 715 | 698 | ) { | 716 | 699 | param($obj, $expectedTable) | | 726 | 709 | abc 123 | 727 | 710 |
| 728 | 711 |
| 729 | | -
| 730 | 712 | "@ }, | 731 | 713 | @{ variation = "left/left"; obj = [PSCustomObject]@{a="abc";b="abc"}; expectedTable = @" | 732 | 714 |
| | 735 | 717 | abc abc | 736 | 718 |
| 737 | 719 |
| 738 | | -
| 739 | 720 | "@ }, | 740 | 721 | @{ variation = "right/left"; obj = [PSCustomObject]@{a=123;b="abc"}; expectedTable = @" | 741 | 722 |
| @@ -744,7 +725,6 @@ abc abc | 744 | 725 | 123 abc | 745 | 726 |
| 746 | 727 |
| 747 | | -
| 748 | 728 | "@ }, | 749 | 729 | @{ variation = "right/right"; obj = [PSCustomObject]@{a=123;b=123}; expectedTable = @" | 750 | 730 |
| @@ -753,7 +733,6 @@ abc abc | 753 | 733 | 123 123 | 754 | 734 |
| 755 | 735 |
| 756 | | -
| 757 | 736 | "@ } | 758 | 737 | ) { | 759 | 738 | param($obj, $expectedTable) | @@ -771,7 +750,6 @@ A B Name | 771 | 750 | multiline content | 772 | 751 |
| 773 | 752 |
| 774 | | -
| 775 | 753 | "@ }, | 776 | 754 | @{ variation = "left"; obj = [pscustomobject] @{Name="This`nIs some random`nmultiline content";A=1;B=2}; expectedTable = @" | 777 | 755 |
| @@ -782,7 +760,6 @@ Is some random | 782 | 760 | multiline content | 783 | 761 |
| 784 | 762 |
| 785 | | -
| 786 | 763 | "@ }, | 787 | 764 | @{ variation = "middle"; obj = [pscustomobject] @{A=1;Name="This`nIs some random`nmultiline content";B=2}; expectedTable = @" | 788 | 765 |
| @@ -793,7 +770,6 @@ A Name B | 793 | 770 | multiline content | 794 | 771 |
| 795 | 772 |
| 796 | | -
| 797 | 773 | "@ } | 798 | 774 | ) { | 799 | 775 | param($obj, $expectedTable) | |
Collapse file Copy file name to clipboardExpand all lines: test/powershell/Modules/Microsoft.PowerShell.Utility/Out-File.Tests.ps1 +8-10Lines changed: 8 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -83,12 +83,11 @@ Describe "Out-File" -Tags "CI" { | 83 | 83 | $actual[3] | Should -Match "some test text" | 84 | 84 | $actual[4] | Should -BeNullOrEmpty | 85 | 85 | $actual[5] | Should -BeNullOrEmpty | 86 | | - $actual[6] | Should -BeNullOrEmpty | 87 | | - $actual[7] | Should -Match "text" | 88 | | - $actual[8] | Should -Match "----" | 89 | | - $actual[9] | Should -Match "some test text" | | 86 | + $actual[6] | Should -Match "text" | | 87 | + $actual[7] | Should -Match "----" | | 88 | + $actual[8] | Should -Match "some test text" | | 89 | + $actual[9] | Should -BeNullOrEmpty | 90 | 90 | $actual[10] | Should -BeNullOrEmpty | 91 | | - $actual[11] | Should -BeNullOrEmpty | 92 | 91 | } | 93 | 92 |
| 94 | 93 | 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" { | 119 | 118 | $actual[3] | Should -Match "some test text" | 120 | 119 | $actual[4] | Should -BeNullOrEmpty | 121 | 120 | $actual[5] | Should -BeNullOrEmpty | 122 | | - $actual[6] | Should -BeNullOrEmpty | 123 | | - $actual[7] | Should -Match "text" | 124 | | - $actual[8] | Should -Match "----" | 125 | | - $actual[9] | Should -Match "some test text" | | 121 | + $actual[6] | Should -Match "text" | | 122 | + $actual[7] | Should -Match "----" | | 123 | + $actual[8] | Should -Match "some test text" | | 124 | + $actual[9] | Should -BeNullOrEmpty | 126 | 125 | $actual[10] | Should -BeNullOrEmpty | 127 | | - $actual[11] | Should -BeNullOrEmpty | 128 | 126 |
| 129 | 127 | # reset to not read only so it can be deleted | 130 | 128 | Set-ItemProperty -Path $testfile -Name IsReadOnly -Value $false | |
|