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

Function test_rust_const_and_static

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

Source from the content-addressed store, hash-verified

240
241#[test]
242fn test_rust_const_and_static() {
243 let source = r#"
244pub const MAX_SIZE: usize = 1024;
245static COUNTER: u32 = 0;
246"#;
247 let extractor = RustExtractor;
248 let result = extractor.extract("consts.rs", source);
249 assert!(result.errors.is_empty(), "errors: {:?}", result.errors);
250 let consts: Vec<_> = result
251 .nodes
252 .iter()
253 .filter(|n| n.kind == NodeKind::Const)
254 .collect();
255 assert_eq!(consts.len(), 1);
256 assert_eq!(consts[0].name, "MAX_SIZE");
257 let statics: Vec<_> = result
258 .nodes
259 .iter()
260 .filter(|n| n.kind == NodeKind::Static)
261 .collect();
262 assert_eq!(statics.len(), 1);
263 assert_eq!(statics[0].name, "COUNTER");
264}
265
266#[test]
267fn test_rust_type_alias() {

Callers

nothing calls this directly

Calls 2

collectMethod · 0.80
extractMethod · 0.45

Tested by

no test coverage detected