dialoguer icon indicating copy to clipboard operation
dialoguer copied to clipboard

How to write unit testing for dialoguer ?

Open sdttttt opened this issue 5 years ago • 4 comments
trafficstars

Thank you for this great project :)

I wrote an interactive cli program. I want to do unit tests for some of these input actions to try to improve my test coverage. But I have encountered difficulties, I tried to use io::stdout, but it didn't work.

How do I test the movements of dialoguer?

sdttttt avatar Nov 10 '20 08:11 sdttttt

Unfortunately, I haven't looked into it, but I am open to PRs.

pksunkara avatar Nov 10 '20 09:11 pksunkara

Unfortunately, I haven't looked into it, but I am open to PRs.

Thank for your precious time to answer my question! I'll try to find another way.

sdttttt avatar Nov 10 '20 12:11 sdttttt

I was about to ask the same question... I was wondering if there was a stub implementation for the IO in Term, maybe it's possible to just stub Term?

xenoterracide avatar Jun 11 '21 14:06 xenoterracide

Might be worth merging #158 before embarking on this, in order to track the progress

That is, assuming whatever is used to unit test crates using dialoguer is also used to unit test dialoguer itself

danieleades avatar Dec 05 '21 14:12 danieleades