From 555d2a7ba53dac46e999d119b5d59a376c316a6e Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 13 Sep 2017 20:49:17 -0700 Subject: [PATCH] Identifier tests --- src/schala_lang/parsing.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/schala_lang/parsing.rs b/src/schala_lang/parsing.rs index 888b56a..0dcb9de 100644 --- a/src/schala_lang/parsing.rs +++ b/src/schala_lang/parsing.rs @@ -621,6 +621,9 @@ mod parse_tests { macro_rules! op { ($op:expr) => { Operation { op: Rc::new($op.to_string()) } } } + macro_rules! var { + ($var:expr) => { Variable(Rc::new($var.to_string())) } + } #[test] 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")))])); + } }