rogpeppe / go-internal

Selected Go-internal packages factored out from the standard library
BSD 3-Clause "New" or "Revised" License
823 stars 67 forks source link

testscript: expose (*TestScript).stdout via SetStdout(string) #217

Closed myitcv closed 1 year ago

myitcv commented 1 year ago

(see commit message)

myitcv commented 1 year ago
  • Please add a test case for a command that writes to stdout and stderr, and then returns an error. I wonder if stderr is then kept at all, for example.

I've replied to this point in https://github.com/rogpeppe/go-internal/issues/139#issuecomment-1522914966 so we keep decisions in the issue (because it feels like I'm straying from the PR being "just" the implementation here).

  • The wording for "updates the last stdout/stderr" feels slightly confusing; it feels like I could/should call it multiple times, and "last" isn't entirely correct when one is running the current command. How about "SetStdout can be used by commands in Params.Cmds to provide a resulting stdout string", since I don't believe we have another usecase yet?

Will fix this as/when we agree on the API/approach.

myitcv commented 1 year ago

Closing in favour of #216