aboutsummaryrefslogtreecommitdiff
path: root/mingling_pathf/test/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-28 06:21:56 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-28 06:21:56 +0800
commit0f84a88d0b2c9205ec1b3cbfa18ffe05478e5a64 (patch)
tree0d5d3ddff999937599f82e7c0fd1b585d826c9e7 /mingling_pathf/test/src
parentda5e1a21fce9a303767af4a6d3cab8f0d66e5c87 (diff)
feat(mingling_pathf): add pattern analyzer module for struct detection
Add a `PatternAnalyzer` with an `AnalyzePattern` trait to detect and extract struct declarations from Rust source files, supporting nested inline modules.
Diffstat (limited to 'mingling_pathf/test/src')
-rw-r--r--mingling_pathf/test/src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/mingling_pathf/test/src/lib.rs b/mingling_pathf/test/src/lib.rs
index 742e9d0..dbbd76d 100644
--- a/mingling_pathf/test/src/lib.rs
+++ b/mingling_pathf/test/src/lib.rs
@@ -37,3 +37,14 @@ fn test_module_pathf() {
assert_eq!(mapping.get("src/use_all.rs").unwrap(), "crate");
assert_eq!(mapping.get("src/main.rs").unwrap(), "crate");
}
+
+#[test]
+fn test_pattern_analyzer() {
+ let dir = current_dir().unwrap().join("test_proj");
+ let mut analyzer = mingling_pathf::pattern_analyzer::init();
+ analyzer.add_pattern(mingling_pathf::patterns::BasicStructPattern);
+
+ let result = analyzer.analyze_file(dir.join("src/has_sub_mod.rs")).unwrap();
+
+ assert!(result.contains("::directly_sub_mod::DirectlySubModStruct"));
+}