Skip to content

Commit e7b3af0

Browse files
authored
Feat/support op associaty (#25)
* feat: support operator associativity * feat: update * feat: update unit tests
1 parent 5f18357 commit e7b3af0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,18 @@ mod tests {
242242
#[test]
243243
fn test_register_infix_op() {
244244
register_infix_op(
245-
"---",
245+
"right_minus",
246246
100,
247247
InfixOpType::CALC,
248248
InfixOpAssociativity::RIGHT,
249249
Arc::new(|left, right| Ok(Value::from(left.integer()? - right.integer()?))),
250250
);
251-
let input = "100---55---44";
251+
let input = "100 right_minus 55 right_minus 44";
252252
let ans = execute(input, create_context!());
253+
match &ans {
254+
Ok(_) => {}
255+
Err(e) => print!("err is {}", e),
256+
}
253257
assert!(ans.is_ok());
254258
assert_eq!(ans.unwrap(), Value::from(89));
255259
}

0 commit comments

Comments
 (0)