MCPcopy Create free account
hub / github.com/Notgnoshi/generative / tool

Function tool

tests/mod.rs:38–56  ·  view source on GitHub ↗

Get a command to run the given tool with Cargo

(name: &'static str)

Source from the content-addressed store, hash-verified

36
37/// Get a command to run the given tool with Cargo
38pub fn tool(name: &'static str) -> Command {
39 // XXX: Using nextest somewhat defeats this cache, because it runs each test in a separate
40 // process, so the cache has to be rebuilt each time. But having it at least makes me feel
41 // like I tried :/
42 static TOOL_PATH_CACHE: LazyLock<Mutex<HashMap<&'static str, PathBuf>>> =
43 LazyLock::new(|| Mutex::new(HashMap::new()));
44
45 let mut cache = TOOL_PATH_CACHE.lock().unwrap();
46 // assert_cmd::cargo::cargo_bin is deprecated but cargo_bin! requires string literal, not &'static str
47 #[allow(deprecated)]
48 let path = cache
49 .entry(name)
50 // TODO: Support the various Python tools as well
51 .or_insert_with(|| assert_cmd::cargo::cargo_bin(name));
52
53 let mut cmd = Command::new(path);
54 cmd.arg("--log-level=TRACE");
55 cmd
56}

Callers 15

test_triangulate_graphFunction · 0.85
test_triangleFunction · 0.85
test_quadFunction · 0.85
test_raggedFunction · 0.85
test_hexagonFunction · 0.85
test_radialFunction · 0.85

Calls

no outgoing calls

Tested by 15

test_triangulate_graphFunction · 0.68
test_triangleFunction · 0.68
test_quadFunction · 0.68
test_raggedFunction · 0.68
test_hexagonFunction · 0.68
test_radialFunction · 0.68