Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for CLI #42

Open
guptarohit opened this issue Jun 21, 2023 · 2 comments
Open

Add tests for CLI #42

guptarohit opened this issue Jun 21, 2023 · 2 comments
Labels
CLI enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@guptarohit
Copy link
Owner

We should have tests for CLI as well

@guptarohit guptarohit added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 21, 2023
@KarlHeitmann
Copy link
Contributor

Do you have any idea on how to make the tests for CLI? I am quite new to go, I've done some testing on Rust, and I took a look at asciigraph_test.go file and understand how it works. But how can I test the for s.Scan() { ... } block on line 104? Do you have any resource or example I can take as source of inspiration? Would you like to test the flags passed to CLI are doing the right thing?

@guptarohit
Copy link
Owner Author

guptarohit commented Jul 8, 2023

This would be tricky, possibly we have to redirect stdin & stdout. Redirect os.stdout to some in-memory buffer or temp file maybe? And similarly, pass out input test data to os.stdin.
Unfortunately atm I don't have any related resource for it, but if I find anything related to it I'll share here.
Yes, testing flags as well would be good idea.

@guptarohit guptarohit added the CLI label Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants