mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
add usage test
This commit is contained in:
parent
8eb287dfab
commit
eed8ff38e6
1 changed files with 26 additions and 0 deletions
|
@ -765,4 +765,30 @@ mod test_usage_analysis {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn record_pattern_optional_fields() {
|
||||
usage_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
a = 34
|
||||
|
||||
when r is
|
||||
{ x, y ? a, z ? a } -> x + y + z
|
||||
"#
|
||||
),
|
||||
|interns| {
|
||||
let mut usage = VarUsage::default();
|
||||
let home = test_home();
|
||||
|
||||
usage.register_with(interns.symbol(home, "a".into()), &Simple(Shared));
|
||||
usage.register_with(interns.symbol(home, "x".into()), &Simple(Seen));
|
||||
usage.register_with(interns.symbol(home, "y".into()), &Simple(Seen));
|
||||
usage.register_with(interns.symbol(home, "z".into()), &Simple(Seen));
|
||||
usage.register_shared(Symbol::NUM_ADD);
|
||||
|
||||
usage
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue