1
0
Fork 0

Expand unary and assign tests

This commit is contained in:
Vili Sinervä 2025-01-31 14:03:20 +02:00
parent 385dc98255
commit ca254a34c6
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996

View file

@ -160,6 +160,12 @@ fn test_unary_basic() {
let result = parse(&tokenize("-1"));
assert_eq!(result, UnaryOp("-", int_ast!(1)));
let result = parse(&tokenize("-1 + 2"));
assert_eq!(
result,
BinaryOp(un_ast!("-", int_ast!(1)), "+", int_ast!(2))
);
}
#[test]
@ -172,6 +178,12 @@ fn test_unary_chain() {
let result = parse(&tokenize("--1"));
assert_eq!(result, UnaryOp("-", un_ast!("-", int_ast!(1))));
let result = parse(&tokenize("--1 + 2"));
assert_eq!(
result,
BinaryOp(un_ast!("-", un_ast!("-", int_ast!(1))), "+", int_ast!(2))
);
}
#[test]