Skip to content

Conversation

@dnagir
Copy link

@dnagir dnagir commented Jun 15, 2023

It is useful to test the help output for the non-trivial CLIs and in the
environment where an example outputs are desired.

Before this, testing for help required resorting to os/exec.

After this, the consumer test can swap the cli.Stderr for testing
purposes while not affecting any other details of the mow.cli.

The stdOut is not published as it is only used internally for
testing and has no impact on consumers as mow.cli never prints to
STDOUT.

NOTE: alternative implementation exists but has a larger "blast radius".

It is useful to test the help output for the non-trivial CLIs and in the
environment where an example outputs are desired.

Before this, testing for help required resorting to `os/exec`.

After this, the consumer test can swap the `cli.Stderr` for testing
purposes while not affecting any other details of the `mow.cli`.

The `stdOut` is not published as it is only used internally for
testing and has no impact on consumers as `mow.cli` never prints to
STDOUT.

NOTE: [alternative implementation] exists but has a larger "blast radius".

[alternative implementation]: #128
@dnagir dnagir closed this by deleting the head repository May 18, 2024
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