MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / new

Method new

atomic-cli/tests/it/diagnostics_integration_test.rs:19–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18impl Fixture {
19 fn new() -> Self {
20 let home = tempfile::tempdir().unwrap();
21 let work = tempfile::tempdir_in(home.path()).unwrap();
22 // Cargo can release its target lock while tests run, allowing another
23 // worktree to replace the shared binary between fixtures or commands.
24 static BINARY: OnceLock<(Vec<u8>, std::fs::Permissions)> = OnceLock::new();
25 let (bytes, permissions) = BINARY.get_or_init(|| {
26 let path = Path::new(env!("CARGO_BIN_EXE_atomic"));
27 (
28 std::fs::read(path).expect("read test binary"),
29 std::fs::metadata(path)
30 .expect("stat test binary")
31 .permissions(),
32 )
33 });
34 let binary = home.path().join("atomic-under-test");
35 std::fs::write(&binary, bytes).expect("pin test binary");
36 std::fs::set_permissions(&binary, permissions.clone())
37 .expect("make test binary executable");
38 Self { work, home, binary }
39 }
40
41 fn run(&self, args: &[&str]) -> Output {
42 self.run_at(self.work.path(), args)

Callers

nothing calls this directly

Calls 7

set_permissionsFunction · 0.85
readFunction · 0.70
writeFunction · 0.70
unwrapMethod · 0.45
pathMethod · 0.45
permissionsMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected