()
| 1312 | assert_eq!(exit, Some(42), "cross-module call should return 42"); |
| 1313 | } |
| 1314 | |
| 1315 | /// Verify cross-module calls through an intermediate module. |
| 1316 | #[test] |
| 1317 | fn cross_module_la_works() { |
| 1318 | let mut pipeline = CompilationPipeline::new(); |
| 1319 | pipeline.set_write_artifacts(false); |
| 1320 | |
| 1321 | let stdlib_objs = |
| 1322 | CompilationPipeline::compile_stdlib_objects(TargetMode::Hosted).expect("stdlib compile"); |
| 1323 | |
| 1324 | // Module A: a helper returning 99 |
| 1325 | let module_a = r#" |
| 1326 | export get_99: () -> i32 { |
| 1327 | return 99 |
| 1328 | } |
| 1329 | "#; |
| 1330 | |
| 1331 | // Module B: calls module A's function |
| 1332 | let module_b = r#" |
| 1333 | external get_99: () -> i32 |
| 1334 | |
| 1335 | main: () -> i32 { |
| 1336 | return get_99() |
| 1337 | } |
| 1338 | "#; |
| 1339 | |
| 1340 | let a_result = pipeline.compile(module_a).expect("module a compile"); |
| 1341 | let (_, a_tokens) = pipeline |
nothing calls this directly
no test coverage detected