MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / hll_exports_control_object_global_visibility

Function hll_exports_control_object_global_visibility

tests/integration/linker.rs:230–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228
229#[test]
230fn hll_exports_control_object_global_visibility() {
231 let assembled = compile_object(
232 r#"
233secret: () -> i32 { return 41 }
234private_data: i64 = 1
235
236export api: () -> i32 {
237 return secret()
238}
239
240export shared: i64 = 7
241"#,
242 );
243
244 assert!(assembled.has_symbol("secret"), "private function label should exist");
245 assert!(
246 !assembled.is_symbol_global("secret"),
247 "unexported function should stay local"
248 );
249 assert!(
250 !assembled.is_symbol_global("private_data"),
251 "unexported global should stay local"
252 );
253 assert!(assembled.is_symbol_global("api"), "exported function should be global");
254 assert!(
255 assembled.is_symbol_global("shared"),
256 "exported global should be global"
257 );
258}
259
260#[test]
261fn object_linker_does_not_resolve_external_to_private_symbol() {

Callers

nothing calls this directly

Calls 1

compile_objectFunction · 0.85

Tested by

no test coverage detected