Skip to content

Commit 3684d92

Browse files
committed
updates
Signed-off-by: Jessie Frazelle <github@jessfraz.com>
1 parent de9911a commit 3684d92

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#![cfg(feature = "python")]
2+
#![allow(missing_docs)]
3+
4+
use std::{collections::BTreeMap, path::PathBuf};
5+
6+
#[test]
7+
fn print_duplicate_stub_names() {
8+
// Force-link some representative types; inventory should still see all registrants.
9+
use kittycad_modeling_cmds as _;
10+
11+
let info = pyo3_stub_gen::StubInfo::from_project_root(
12+
"kittycad_modeling_cmds".to_string(),
13+
PathBuf::from(env!("CARGO_MANIFEST_DIR")),
14+
)
15+
.expect("collect stub info");
16+
17+
let mut class_counts: BTreeMap<&str, usize> = BTreeMap::new();
18+
let mut enum_counts: BTreeMap<&str, usize> = BTreeMap::new();
19+
20+
for module in info.modules.values() {
21+
for class in module.class.values() {
22+
*class_counts.entry(class.name).or_default() += 1;
23+
}
24+
for en in module.enum_.values() {
25+
*enum_counts.entry(en.name).or_default() += 1;
26+
}
27+
}
28+
29+
let dup_classes: Vec<_> = class_counts
30+
.iter()
31+
.filter(|(_, &c)| c > 1)
32+
.map(|(n, c)| (n.to_string(), c))
33+
.collect();
34+
let dup_enums: Vec<_> = enum_counts
35+
.iter()
36+
.filter(|(_, &c)| c > 1)
37+
.map(|(n, c)| (n.to_string(), c))
38+
.collect();
39+
40+
eprintln!("duplicate classes: {:?}", dup_classes);
41+
eprintln!("duplicate enums: {:?}", dup_enums);
42+
43+
// This is informational; do not fail test. If we decide to enforce, we can assert emptiness.
44+
}

0 commit comments

Comments
 (0)