trycmd icon indicating copy to clipboard operation
trycmd copied to clipboard

CWD for README.md commands

Open jayvdb opened this issue 2 years ago • 1 comments

The sequence in https://github.com/Electron100/butane/commit/c5761ccd9b1e5716a867e746b95d59a7e4f8ddd7#diff-b70d3a47c15879d308451b54821682f1d63518db732881b434c4110d9ca7a767 assumes that the user is in the directory containing the .md file. I think that is a reasonable default for trycmd. I don't see any set_current_dir in this project.

It would also be useful to add something to https://docs.rs/trycmd/latest/trycmd/struct.TestCases.html to allow setting the CWD for that set of cases.

jayvdb avatar Jul 29 '23 04:07 jayvdb

Current behavior is

  • .toml files can set CWD explicitly
  • Default CWD to path.with_ext(".in") if it exists
  • Otherwise, default to parent process CWD which is the manifest dir

See also https://github.com/assert-rs/trycmd/blob/main/src/schema.rs#L85

Most of those cases listed came out specific use cases but the CWD never came up in a case without a .in, so I hadn't really considered.

Since we treat everything else relative to path.parent(), I think it makes sense to make this change.

This will be a breaking change though

epage avatar Jul 31 '23 21:07 epage