()
| 228 | |
| 229 | #[test] |
| 230 | fn hll_exports_control_object_global_visibility() { |
| 231 | let assembled = compile_object( |
| 232 | r#" |
| 233 | secret: () -> i32 { return 41 } |
| 234 | private_data: i64 = 1 |
| 235 | |
| 236 | export api: () -> i32 { |
| 237 | return secret() |
| 238 | } |
| 239 | |
| 240 | export 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] |
| 261 | fn object_linker_does_not_resolve_external_to_private_symbol() { |
nothing calls this directly
no test coverage detected