Skip to content

Commit

Permalink
fix: used var detection for match function (prefix-dev#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Nov 6, 2024
1 parent 0ea2805 commit db35082
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/used_variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn extract_variable_from_expression(expr: &Expr, variables: &mut HashSet<String>
} else if function == "cdt" {
variables.insert("cdt_name".into());
variables.insert("cdt_arch".into());
} else if function == "cmp" {
} else if function == "match" {
extract_variable_from_expression(&call.args[0], variables);
}
}
Expand Down Expand Up @@ -316,6 +316,8 @@ mod test {
- ${{ pin_subpackage("foobar") }}
- ${{ pin_compatible(compatible) }}
- ${{ pin_compatible(abc ~ def) }}
- if: match(xpython, ">=3.7")
then: numpy 100
"#;

let recipe_node = crate::recipe::custom_yaml::Node::parse_yaml(0, recipe).unwrap();
Expand All @@ -332,6 +334,7 @@ mod test {
assert!(used_vars.contains("compatible"));
assert!(used_vars.contains("abc"));
assert!(used_vars.contains("def"));
assert!(used_vars.contains("xpython"));
}

#[test]
Expand Down

0 comments on commit db35082

Please sign in to comment.