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) => { (modulo: $modulo:expr, $given:expr) => {
if $given % $modulo != 0 {
Err(Error::MismatchedArgCount( Err(Error::MismatchedArgCount(
($given / $modulo) * $modulo + $modulo, ($given / $modulo) * $modulo + $modulo,
$given, $given,
))? ))?
}
}; };
} }

View file

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