Add unit test for value aliasing
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
c6f8bfff0b
commit
c190884bca
@@ -1638,6 +1638,25 @@ mod tests {
|
|||||||
assert_eq!(message, "expected argument type");
|
assert_eq!(message, "expected argument type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn aliases() {
|
||||||
|
let (func, details) = Parser::new("function qux() {
|
||||||
|
ebb0:
|
||||||
|
v4 = iconst.i8 6
|
||||||
|
vx3 -> v4
|
||||||
|
v1 = iadd_imm vx3, 17
|
||||||
|
}")
|
||||||
|
.parse_function(None)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(func.name.to_string(), "qux");
|
||||||
|
let v4 = details.map.lookup_str("v4").unwrap();
|
||||||
|
assert_eq!(v4.to_string(), "v0");
|
||||||
|
let vx3 = details.map.lookup_str("vx3").unwrap();
|
||||||
|
assert_eq!(vx3.to_string(), "vx0");
|
||||||
|
let aliased_to = func.dfg.resolve_aliases(Value::table_with_number(0).unwrap());
|
||||||
|
assert_eq!(aliased_to.to_string(), "v0");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn signature() {
|
fn signature() {
|
||||||
let sig = Parser::new("()").parse_signature(None).unwrap();
|
let sig = Parser::new("()").parse_signature(None).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user