MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / build_resolver

Function build_resolver

compiler/tests/packages.rs:83–113  ·  view source on GitHub ↗
(modules: &HashMap<String, ModuleDef>, aliases: &HashMap<String, String>, manifests: &HashMap<String, ManifestDef>)

Source from the content-addressed store, hash-verified

81 }
82
83 fn build_resolver(modules: &HashMap<String, ModuleDef>, aliases: &HashMap<String, String>, manifests: &HashMap<String, ManifestDef>) -> TestResolver {
84 let mut r = TestResolver::new();
85 for (spec, def) in modules {
86 match def {
87 ModuleDef::Native { native, bytes } => {
88 let bindings: Vec<NativeBinding> = native.iter()
89 .map(|n| test_native(n)
90 .unwrap_or_else(|| panic!("unknown test native: {}", n)))
91 .collect();
92 r = r.with_native(spec, bindings);
93 if let Some(b) = bytes { r = r.with_bytes(spec, b.clone().into_bytes()); }
94 }
95 ModuleDef::Code { code, bytes } => {
96 r = r.with_code(spec, code);
97 if let Some(b) = bytes { r = r.with_bytes(spec, b.clone().into_bytes()); }
98 }
99 }
100 /* Auto self-alias bare-name modules so flat fixtures work without explicit `aliases`. */
101 if !spec.contains('/') {
102 r = r.with_alias(spec, spec);
103 }
104 }
105 for (name, target) in aliases {
106 r = r.with_alias(name, target);
107 }
108 for (dir, m) in manifests {
109 let pairs: Vec<(&str, &str)> = m.imports.iter().map(|(k, v)| (k.as_str(), v.as_str())).collect();
110 r = r.with_manifest(dir, &pairs, m.extends.as_deref());
111 }
112 r
113 }
114
115 /* NoopResolver path: imports must produce a clean diagnostic, not panic. Lives in Rust since the JSON runner always builds a TestResolver. */
116 #[test]

Callers 1

packages_casesFunction · 0.85

Calls 10

test_nativeFunction · 0.85
collectMethod · 0.80
with_nativeMethod · 0.80
with_bytesMethod · 0.80
with_codeMethod · 0.80
with_aliasMethod · 0.80
with_manifestMethod · 0.80
iterMethod · 0.45
containsMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected