Tests for qualified names

This commit is contained in:
greg 2019-09-01 01:07:00 -07:00
parent 34abb9b081
commit f96469178d

View File

@ -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")))]));