Skip to content

Commit 99bd3bd

Browse files
committed
Tests: document TestEnv
1 parent 0cc3398 commit 99bd3bd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/cargo-gpu/src/test.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ use std::io::Write as _;
88
use std::path::PathBuf;
99
use tempfile::TempDir;
1010

11+
/// `TestEnv` sets up a temp dir in `./target/cargo-gpu-test/` that is used as the cache dir. Not initializing a
12+
/// `TestEnv` and asking for the cache dir will panic, to ensure you set it up. Calling [`Self::setup_shader_crate`]
13+
/// or [`Self::setup_shader_crate_with_cargo_toml`] will copy the `shader_crate_template` into the temp dir and return
14+
/// you the path to it, so each test now has it's unique copy and won't race to change the template in the repo.
15+
/// Dropping `TestEnv` will clean up the dir, except when panic unwinding, so you can debug failures.
1116
#[must_use]
1217
pub struct TestEnv(TempDir);
1318

0 commit comments

Comments
 (0)