MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / test_rust_module

Function test_rust_module

tests/extraction_suite/rust.rs:284–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

282
283#[test]
284fn test_rust_module() {
285 let source = r#"
286pub mod inner {
287 pub fn foo() {}
288}
289"#;
290 let extractor = RustExtractor;
291 let result = extractor.extract("lib.rs", source);
292 assert!(result.errors.is_empty(), "errors: {:?}", result.errors);
293 let modules: Vec<_> = result
294 .nodes
295 .iter()
296 .filter(|n| n.kind == NodeKind::Module)
297 .collect();
298 assert_eq!(modules.len(), 1);
299 assert_eq!(modules[0].name, "inner");
300 // The function inside the module should be extracted too
301 let fns: Vec<_> = result
302 .nodes
303 .iter()
304 .filter(|n| n.kind == NodeKind::Function)
305 .collect();
306 assert_eq!(fns.len(), 1);
307 assert_eq!(fns[0].name, "foo");
308}
309
310#[test]
311fn test_rust_cfg_test_module_annotations() {

Callers

nothing calls this directly

Calls 2

collectMethod · 0.80
extractMethod · 0.45

Tested by

no test coverage detected