MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / insert_test

Method insert_test

crates/test/src/lib.rs:327–351  ·  view source on GitHub ↗
(
        &self,
        path: &Path,
        config: config::WitConfig,
        kind: TestKind,
        tests: &mut HashMap<String, Test>,
    )

Source from the content-addressed store, hash-verified

325 }
326
327 fn insert_test(
328 &self,
329 path: &Path,
330 config: config::WitConfig,
331 kind: TestKind,
332 tests: &mut HashMap<String, Test>,
333 ) -> Result<()> {
334 let test_name = path
335 .file_name()
336 .and_then(|s| s.to_str())
337 .context("non-utf-8 filename")?;
338 let prev = tests.insert(
339 test_name.to_string(),
340 Test {
341 name: test_name.to_string(),
342 path: path.to_path_buf(),
343 config,
344 kind,
345 },
346 );
347 if prev.is_some() {
348 bail!("duplicate test name `{test_name}` found");
349 }
350 Ok(())
351 }
352
353 /// Loads a test from `dir` using the `wit` file in the directory specified.
354 ///

Callers 1

discover_testsMethod · 0.80

Calls 3

and_thenMethod · 0.80
insertMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected