()
| 99 | |
| 100 | #[test] |
| 101 | fn test_call_pseudo_expansion() { |
| 102 | // Test specifically the 'call' pseudo-instruction expansion |
| 103 | let tokens = vec![ |
| 104 | RvInstruction::Directive("\t.text".to_string()), |
| 105 | RvInstruction::Label("main".to_string()), |
| 106 | RvInstruction::Directive("\t.globl main".to_string()), |
| 107 | |
| 108 | // Call another function using call pseudo |
| 109 | RvInstruction::Pseudo(PseudoInstruction::Call { |
| 110 | symbol: "target_func".to_string(), |
| 111 | }), |
| 112 | |
| 113 | RvInstruction::Real(RealInstruction::Jalr(Jalr::new(0, 1, 0))), // ret |
| 114 | |
| 115 | RvInstruction::Label("target_func".to_string()), |
| 116 | RvInstruction::Real(RealInstruction::Jalr(Jalr::new(0, 1, 0))), // ret |
| 117 | ]; |
| 118 | |
| 119 | match Assembler::assemble(&tokens) { |
| 120 | Ok(output) => { |
| 121 | // call expands to auipc + jalr = at least 2 instructions |
| 122 | assert!(output.text_bytes().len() >= 8, "Expected at least 2 instructions from call expansion"); |
| 123 | assert!(output.has_symbol("main")); |
| 124 | assert!(output.has_symbol("target_func")); |
| 125 | } |
| 126 | Err(e) => { |
| 127 | panic!("Assembly failed for call test: {}", e.message); |
| 128 | } |
| 129 | } |
| 130 | } |
nothing calls this directly
no outgoing calls
no test coverage detected