()
| 193 | |
| 194 | #[test] |
| 195 | fn allows_stack_and_heap_arrays() { |
| 196 | let source = r#" |
| 197 | main: () -> i32 { |
| 198 | stack: i32[3] = [] |
| 199 | stack[0] = 1 |
| 200 | stack[1] = 2 |
| 201 | stack[2] = stack[0] + stack[1] |
| 202 | |
| 203 | heap: i32* = new(i32, 2) |
| 204 | defer free(heap) |
| 205 | heap[0] = stack[2] |
| 206 | heap[1] = 4 |
| 207 | |
| 208 | return heap[0] + heap[1] |
| 209 | } |
| 210 | "#; |
| 211 | |
| 212 | let mut pipeline = CompilationPipeline::new(); |
| 213 | pipeline.set_write_artifacts(false); |
| 214 | let result = pipeline.compile(source); |
| 215 | assert!( |
| 216 | result.is_ok(), |
| 217 | "expected stack and heap arrays to compile successfully: {:?}", |
| 218 | result.err() |
| 219 | ); |
| 220 | } |
| 221 | |
| 222 | #[test] |
| 223 | fn allows_array_literals_through_assembly() { |
nothing calls this directly
no test coverage detected