Repository navigation
Commit 4382181
committed
fix(desktop): keep the new PATH test off the process environment
The Linux Rust Check failed to compile the test target:
error[E0433]: cannot find module or crate `env` in this scope
`mod tests` imports `std::env` under `#[cfg(target_os = "macos")]`, so a
bare `env::` in a test compiles on exactly the one target I built and
nowhere else.
Fully qualifying it would have been enough to compile, but the test was
wrong in a second way worth fixing instead: it read and wrote the
process-wide PATH to steer resolve_on_path, and `cargo test` runs tests on
threads, so it raced every other test that spawns a child.
resolve_on_path is now a thin wrapper over resolve_in_paths, which takes
the paths to search. The test passes its own, asserts that an earlier
entry without the file is skipped rather than given up on, and that an
absent name comes back None instead of being handed back bare. No global
state, and it compiles wherever the module does.
The Linux target cannot be checked from a macOS host -- it needs the GTK
system libraries -- so this is verified by fmt, the workflow's clippy and
cargo test on macOS, 99 passing, plus a read of every env:: use in the
test module: one fully qualified, four inside a macOS-gated test.1 parent 434561e commit 4382181
1 file changed
Lines changed: 26 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4204 | 4204 | | |
4205 | 4205 | | |
4206 | 4206 | | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
4207 | 4216 | | |
4208 | 4217 | | |
4209 | 4218 | | |
4210 | 4219 | | |
4211 | 4220 | | |
4212 | | - | |
| 4221 | + | |
4213 | 4222 | | |
4214 | 4223 | | |
4215 | 4224 | | |
| |||
6483 | 6492 | | |
6484 | 6493 | | |
6485 | 6494 | | |
6486 | | - | |
6487 | 6495 | | |
6488 | | - | |
| 6496 | + | |
6489 | 6497 | | |
| 6498 | + | |
6490 | 6499 | | |
| 6500 | + | |
6491 | 6501 | | |
6492 | | - | |
6493 | | - | |
6494 | | - | |
6495 | | - | |
6496 | | - | |
6497 | | - | |
6498 | | - | |
6499 | | - | |
6500 | | - | |
6501 | | - | |
6502 | | - | |
6503 | | - | |
6504 | | - | |
| 6502 | + | |
| 6503 | + | |
| 6504 | + | |
| 6505 | + | |
| 6506 | + | |
| 6507 | + | |
| 6508 | + | |
6505 | 6509 | | |
6506 | | - | |
6507 | | - | |
6508 | | - | |
6509 | | - | |
6510 | | - | |
6511 | | - | |
6512 | | - | |
6513 | | - | |
| 6510 | + | |
6514 | 6511 | | |
| 6512 | + | |
6515 | 6513 | | |
6516 | | - | |
6517 | | - | |
6518 | | - | |
| 6514 | + | |
| 6515 | + | |
6519 | 6516 | | |
| 6517 | + | |
| 6518 | + | |
6520 | 6519 | | |
6521 | 6520 | | |
6522 | 6521 | | |
| |||
0 commit comments