Hi Tom,

> tl;dr Are there any existing end-to-end testing libraries for CLI 
> applications? Specifically, what I'm looking for is a library that makes it 
> easy to test that "running this command should produce this output" without 
> fear that a buggy application could corrupt the filesystem.

I'd suggest looking at:

* https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript?tab=doc
for the CLI testing aspect
* https://pkg.go.dev/mvdan.cc/dockexec?tab=overview for the isolation piece

There are lots of examples of where testscript is being used:
https://github.com/rogpeppe/go-internal/wiki/Users-of-testscript

govim is one such an example where we also provide an example of how
to run those tests via dockexec:

https://github.com/govim/govim/wiki/govim-tests#running-tests---using-cmdgo

In our case it's not so much for isolation, rather providing dependencies.

The #tools channel on slack (or mailing list
https://groups.google.com/forum/#!forum/golang-tools) is also a good
place to chat about this more in case you had any follow-ups.

Best,


Paul

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CACoUkn7173qysrk7FrmJFW3FT3hRyKZ0RkvcFE%3DXCrUQPeCLNQ%40mail.gmail.com.

Reply via email to