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

Function stdlib_provides_runtime

tests/vm_diag_test.rs:199–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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]
217fn puts_basic() {
218 let src = r#"
219console := import("console")
220
221main: () -> i32 {
222 console.writeln("Hi".ptr)
223 return 0
224}

Callers

nothing calls this directly

Calls 7

get_stdlib_type_preludeFunction · 0.85
set_write_artifactsMethod · 0.80
anyMethod · 0.80
set_type_preludeMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected