()
| 197 | let mut tokens = Vec::new(); |
| 198 | for (_, src) in get_stdlib_modules_for_mode(TargetMode::Hosted).iter() { |
| 199 | let result = pipeline.compile(src).expect("stdlib compile"); |
| 200 | let (_, t) = pipeline.compile_ir_to_assembly_with_tokens(&result.ir_program); |
| 201 | tokens.extend(t); |
| 202 | } |
| 203 | use asm_to_binary::rv_instruction::RvInstruction; |
| 204 | let has = |name: &str| { |
| 205 | tokens |
| 206 | .iter() |
| 207 | .any(|t| matches!(t, RvInstruction::Label(n) if n == name)) |
| 208 | }; |
| 209 | assert!(has("console_putchar"), "stdlib must define console_putchar"); |
| 210 | assert!(has("print_int"), "stdlib must define print_int"); |
| 211 | assert!(has("sys_exit"), "stdlib must define sys_exit"); |
| 212 | assert!(has("_start"), "stdlib must define _start"); |
| 213 | } |
| 214 | |
| 215 | // Verify console.writeln writes a null-terminated string plus newline. |
| 216 | #[test] |
| 217 | fn puts_basic() { |
| 218 | let src = r#" |
| 219 | console := import("console") |
| 220 | |
| 221 | main: () -> i32 { |
| 222 | console.writeln("Hi".ptr) |
| 223 | return 0 |
| 224 | } |
nothing calls this directly
no test coverage detected