git-fixup icon indicating copy to clipboard operation
git-fixup copied to clipboard

Test panic locations can be outside test functions

Open mightyiam opened this issue 1 month ago • 0 comments

Here is an example of a test failure I'm seeing on b9b27e0b5f0eed13f444a39f4aed406b627fb4eb (main).

thread 'simple_straightline_remote_branch' (1047578) panicked at tests/basic.rs:537:35:
called `Result::unwrap()` on an `Err` value: OutputError { cmd: Some("cd \"/tmp/.tmphrIvID\" && \"git\" \"remote\" \"add\" \"origin\" \"/tmp/.tmpE5EgY4\""), stdin: None, cause: Expected(Output { output: Output { status: ExitStatus(unix_wait_status(768)), stdout: "", stderr: "error: remote origin already exists.\n" } }) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

tests/basic.rs:537:35 is an unwrap inside a test helper. So to see the line that I am actually looking for, I may need a backtrace. An alternative is that test helpers return Result which is unwrapped in the test functions.

mightyiam avatar Jan 11 '26 05:01 mightyiam