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

Function stdlib_provides_malloc

tests/vm_diag_test.rs:112–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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]
128fn putchar_basic() {
129 let src = r#"
130console := import("console")
131
132main: () -> i32 {
133 console.putchar(72)

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