Skip to content

fix unit test by capturing the stdout in buffer for compare#5

Open
WheeskyJack wants to merge 3 commits intoacmpesuecc:mainfrom
WheeskyJack:unit-tests
Open

fix unit test by capturing the stdout in buffer for compare#5
WheeskyJack wants to merge 3 commits intoacmpesuecc:mainfrom
WheeskyJack:unit-tests

Conversation

@WheeskyJack
Copy link
Copy Markdown

@WheeskyJack WheeskyJack commented Oct 18, 2024

hi @IshaanNene ,
this pr fixes the failing tests in unit pkg. issues with original tests was it was not correctly capturing the stdout from actual cmd execution. By setting the cmd stdout to test buffer, we can now capture it and use it for cmd.

#2

use io.Writer from pwd cmd so that it can default to stdout and can be set to other writer in unit test to capture the print.
use io.Writer from ls cmd so that it can default to stdout and can be set to other writer in unit test to capture the print.
Update test function with cmd.SetOut to capture the output and fix failing tests
@bunsamosa-bot
Copy link
Copy Markdown

bunsamosa-bot bot commented Oct 18, 2024

Thank you from Opening this Pull Request, @WheeskyJack ! A Maintainer will review it soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant