fix: incorrect arg counting for modulo

This commit is contained in:
Roman Godmaire 2024-03-09 08:10:02 -05:00
parent 26ba457e8e
commit 040a2518cc
2 changed files with 7 additions and 4 deletions

View file

@ -7,10 +7,12 @@ macro_rules! arg_count {
};
(modulo: $modulo:expr, $given:expr) => {
Err(Error::MismatchedArgCount(
($given / $modulo) * $modulo + $modulo,
$given,
))?
if $given % $modulo != 0 {
Err(Error::MismatchedArgCount(
($given / $modulo) * $modulo + $modulo,
$given,
))?
}
};
}

View file

@ -254,6 +254,7 @@ mod test {
#[rstest]
#[case("{:a}")]
#[case("(not-a-func :uwu)")]
#[case("{:a}")]
fn test_evaluator_fail(#[case] input: &str) {
let env = core_environment();
let tokens = lexer::read(input).unwrap();