File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed
test/PowerShellEditorServices.Test.Host Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -490,8 +490,8 @@ await requestContext.SendResult(
490
490
ChosenItem = "a"
491
491
} ) ;
492
492
493
- // Skip the initial script lines (6 script lines plus 3 blank lines)
494
- await outputReader . ReadLines ( 9 ) ;
493
+ // Skip the initial script lines (6 script lines plus 2 blank lines)
494
+ string [ ] outputLines = await outputReader . ReadLines ( 8 ) ;
495
495
496
496
// Wait for the selection to appear as output
497
497
await evaluateTask ;
@@ -541,18 +541,8 @@ await requestContext.SendResult(
541
541
// Skip the initial script lines (4 script lines plus 2 blank lines)
542
542
string [ ] scriptLines = await outputReader . ReadLines ( 6 ) ;
543
543
544
- // In some cases an extra newline appears after the script lines.
545
- // I have no idea why this happens, but it normally seems to occur
546
- // on my local machine and not the CI server. For now, adjust for
547
- // it here.
548
- string outputLine = await outputReader . ReadLine ( ) ;
549
- if ( string . IsNullOrEmpty ( outputLine ) )
550
- {
551
- outputLine = await outputReader . ReadLine ( ) ;
552
- }
553
-
554
544
// Verify the first line
555
- Assert . Equal ( "Name: John" , outputLine ) ;
545
+ Assert . Equal ( "Name: John" , await outputReader . ReadLine ( ) ) ;
556
546
557
547
// Verify the rest of the output
558
548
string [ ] outputLines = await outputReader . ReadLines ( 4 ) ;
Original file line number Diff line number Diff line change @@ -89,9 +89,11 @@ public async Task<string> ReadLine(string expectedOutputCategory = "stdout")
89
89
outputLines [ i ] ,
90
90
91
91
// The line has a newline if it's not the last segment or
92
- // if the current output string ends with a newline
92
+ // if the last segment is not an empty string and the
93
+ // complete output string ends with a newline
93
94
i < outputLines . Length - 1 ||
94
- nextOutputEvent . Output . EndsWith ( "\n " ) ) ) ;
95
+ ( outputLines [ outputLines . Length - 1 ] . Length > 0 &&
96
+ nextOutputEvent . Output . EndsWith ( "\n " ) ) ) ) ;
95
97
}
96
98
}
97
99
You can’t perform that action at this time.
0 commit comments