mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-09-21 18:57:33 +03:00
Refacto on function eval_predicate_func
by splitting into multiple functions.
This commit is contained in:
parent
4b821f6c7b
commit
5f6879e779
File diff suppressed because it is too large
Load Diff
@ -51,3 +51,15 @@ pub fn eval_predicate_value(
|
||||
PredicateValue::Regex(regex) => Ok(Value::Regex(regex.inner.clone())),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn eval_predicate_value_template(
|
||||
predicate_value: &PredicateValue,
|
||||
variables: &HashMap<String, Value>,
|
||||
) -> Result<String, Error> {
|
||||
match predicate_value {
|
||||
PredicateValue::String(template) => eval_template(template, variables),
|
||||
PredicateValue::Regex(regex) => Ok(regex.inner.to_string()),
|
||||
// All others value should have failed in parsing:
|
||||
_ => panic!("expect a string or a regex predicate value"),
|
||||
}
|
||||
}
|
||||
|
@ -456,6 +456,8 @@ pub enum PredicateFuncValue {
|
||||
value: PredicateValue,
|
||||
operator: bool,
|
||||
},
|
||||
// FIXME: `countEquals` predicate should be replace by `count` filter. This variant should be
|
||||
// removed.
|
||||
CountEqual {
|
||||
space0: Whitespace,
|
||||
value: PredicateValue,
|
||||
@ -480,6 +482,7 @@ pub enum PredicateFuncValue {
|
||||
space0: Whitespace,
|
||||
value: PredicateValue,
|
||||
},
|
||||
// FIXME: why use an empty struct here ?
|
||||
IsInteger {},
|
||||
IsFloat {},
|
||||
IsBoolean {},
|
||||
|
Loading…
Reference in New Issue
Block a user