Fix Unix-only expectations in three System.Console manual tests - #134372
Open
caraioniurie47 wants to merge 1 commit into
Open
caraioniurie47 wants to merge 1 commit into
caraioniurie47 wants to merge 1 commit into
Conversation
Three System.Console manual tests failed on Windows because they expect Unix behaviour: - ReadFromOpenStandardInput expected '\n' right after the typed text; the Windows console ends the line with "\r\n". - ConsoleReadSupportsBackspace read "aab\r" and left the '\n' in Console.In, so ReadLine_BackSpaceCanMoveAcrossWrappedLines, which xunit runs next, returned "" without waiting for input. - CursorLeftFromLastColumn checks the Unix cached cursor position; on Windows the '1' lands on the row after the '2'. It is now [PlatformSpecific(TestPlatforms.AnyUnix)]. Fix dotnet#133898 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-console |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three manual tests in
System.Console.Manual.Testsfail on Windows even when every prompt is followed (#133898). Each expectation came with a Unix-only fix:ReadFromOpenStandardInputexpects\nright after the typed sentence; the Windows console ends the line with\r\n. On Windows it now expects\rfirst.ConsoleReadSupportsBackspacereadsaab\rwithConsole.Read()and leaves the\ninConsole.In, soReadLine_BackSpaceCanMoveAcrossWrappedLines, which xunit runs next, returns""before anything is typed. On Windows it now readsaab\r\n.CursorLeftFromLastColumnchecks the cached cursor position that onlyConsolePal.Unix.cskeeps (Console.Unix: don't calculate cached cursor position from the last column. #78466). It is now[PlatformSpecific(TestPlatforms.AnyUnix)], likeEchoWorksDuringAndAfterProcessThatUsesTerminal.The Unix expectations are unchanged.
Tests
Manual tests don't run in CI.
xunit.consolewas run by hand in a console window, with the test project built from this branch, asked for the four tests, with the trait filters from the generatedRunTests.cmd.CursorLeftFromLastColumnwas filtered out (3 of 19 test cases found), and the other three passed,ConsoleReadSupportsBackspacerunning directly beforeReadLine_BackSpaceCanMoveAcrossWrappedLines, which now waited for input. Not run on Linux or macOS.Resolves #133898
Note
AI-generated, written at my direction and reviewed by me before posting. The manual tests ran on Windows 11 x64 (build 26200) in inbox conhost, typed by hand, on the repo's Debug testhost.