Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWD for README.md commands #220

Open
jayvdb opened this issue Jul 29, 2023 · 1 comment
Open

CWD for README.md commands #220

jayvdb opened this issue Jul 29, 2023 · 1 comment
Labels
A-trycmd Area: trycmd package breaking-change enhancement Improve the expected

Comments

@jayvdb
Copy link

jayvdb commented Jul 29, 2023

The sequence in Electron100/butane@c5761cc#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.

@epage
Copy link
Contributor

epage commented Jul 31, 2023

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

@settings settings bot removed the A-trycmd label Aug 14, 2023
@epage epage added the A-trycmd Area: trycmd package label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trycmd Area: trycmd package breaking-change enhancement Improve the expected
Projects
None yet
Development

No branches or pull requests

2 participants