()
| 110 | // Compile each stdlib module independently; malloc lives in the allocator module. |
| 111 | let mut tokens = Vec::new(); |
| 112 | for (_, src) in get_stdlib_modules_for_mode(TargetMode::Hosted).iter() { |
| 113 | let result = pipeline.compile(src).expect("stdlib compile"); |
| 114 | let (_, t) = pipeline |
| 115 | .compile_ir_to_assembly_with_tokens(&result.ir_program) |
| 116 | .expect("valid IR layout"); |
| 117 | tokens.extend(t); |
| 118 | } |
| 119 | assert!(!tokens.is_empty(), "stdlib token stream must not be empty"); |
| 120 | let has_malloc = tokens.iter().any(|t| { |
| 121 | use asm_to_binary::rv_instruction::RvInstruction; |
| 122 | matches!(t, RvInstruction::Label(n) if n == "malloc") |
| 123 | }); |
| 124 | assert!(has_malloc, "stdlib must define malloc"); |
| 125 | } |
| 126 | |
| 127 | #[test] |
| 128 | fn putchar_basic() { |
| 129 | let src = r#" |
| 130 | console := import("console") |
| 131 | |
| 132 | main: () -> i32 { |
| 133 | console.putchar(72) |
nothing calls this directly
no test coverage detected