| 166 | #[test] |
| 167 | #[should_panic(expected = "assertion failed: name.index() < self.registers.len()")] |
| 168 | fn invalid_assignment() { |
| 169 | let func = function("function %test(i32) -> i32 { block0(v10:i32): return v10 }"); |
| 170 | let mut frame = Frame::new(&func); |
| 171 | let fortytwo = DataValue::I32(42); |
| 172 | |
| 173 | // Since the SSA value ref points to 42 and the function only has 11 slots, this should |
| 174 | // fail. TODO currently this is a panic under the assumption we will not set indexes outside |
| 175 | // of the valid SSA value range but it might be better as a result. |
| 176 | frame.set(ValueRef::from_u32(11), fortytwo.clone()); |
| 177 | } |
| 178 | |
| 179 | #[test] |
| 180 | #[should_panic(expected = "assertion failed: name.index() < self.registers.len()")] |