Identifier tests
This commit is contained in:
parent
291fb61c8d
commit
555d2a7ba5
@ -621,6 +621,9 @@ mod parse_tests {
|
|||||||
macro_rules! op {
|
macro_rules! op {
|
||||||
($op:expr) => { Operation { op: Rc::new($op.to_string()) } }
|
($op:expr) => { Operation { op: Rc::new($op.to_string()) } }
|
||||||
}
|
}
|
||||||
|
macro_rules! var {
|
||||||
|
($var:expr) => { Variable(Rc::new($var.to_string())) }
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parsing_number_literals_and_binexps() {
|
fn parsing_number_literals_and_binexps() {
|
||||||
@ -657,4 +660,9 @@ mod parse_tests {
|
|||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parsing_identifiers() {
|
||||||
|
parse_test!("a", AST(vec![Expression(var!("a"))]));
|
||||||
|
parse_test!("a + b", AST(vec![Expression(binexp!(op!("+"), var!("a"), var!("b")))]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user