From f96469178de392119130305cba2dbc32346a1fca Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 1 Sep 2019 01:07:00 -0700 Subject: [PATCH] Tests for qualified names --- schala-lang/language/src/parsing/test.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/schala-lang/language/src/parsing/test.rs b/schala-lang/language/src/parsing/test.rs index ab07aec..4f2b64c 100644 --- a/schala-lang/language/src/parsing/test.rs +++ b/schala-lang/language/src/parsing/test.rs @@ -165,6 +165,27 @@ fn parsing_identifiers() { }; } + +#[test] +fn qualified_identifiers() { + parse_test_wrap_ast! { + "let q_q = Yolo::Swaggins", + Meta::new(Declaration(Binding { name: rc!(q_q), constant: true, type_anno: None, + expr: Meta::new(Expression::new(Value(QualifiedName(vec![rc!(Yolo), rc!(Swaggins)])))), + })) + } + + parse_test_wrap_ast! { + "thing::item::call()", + exst!(Call { f: bx![ex!(m Value(QualifiedName(vec![rc!(thing), rc!(item), rc!(call)])))], arguments: vec![] }) + } +} + +#[test] +fn reserved_words() { + parse_error!("module::item::call()"); +} + #[test] fn parsing_complicated_operators() { parse_test!("a <- b", AST(vec![exst!(binexp!("<-", val!("a"), val!("b")))]));