Fixed tests

This commit is contained in:
greg 2017-10-08 19:39:41 -07:00
parent 40696b3cbd
commit df877830d3

View File

@ -1173,7 +1173,7 @@ mod parse_tests {
fn parsing_impls() { fn parsing_impls() {
parse_test!("impl Heh { fn yolo(); fn swagg(); }", AST(vec![ parse_test!("impl Heh { fn yolo(); fn swagg(); }", AST(vec![
Declaration(Impl { Declaration(Impl {
type_name: rc!(Heh), type_name: ty!("Heh"),
trait_name: None, trait_name: None,
block: vec![ block: vec![
FuncDecl { name: rc!(yolo), params: vec![] }, FuncDecl { name: rc!(yolo), params: vec![] },
@ -1182,22 +1182,27 @@ mod parse_tests {
parse_test!("impl Mondai for Lollerino { fn yolo(); fn swagg(); }", AST(vec![ parse_test!("impl Mondai for Lollerino { fn yolo(); fn swagg(); }", AST(vec![
Declaration(Impl { Declaration(Impl {
type_name: rc!(Lollerino), type_name: ty!("Lollerino"),
trait_name: Some(rc!(Mondai)), trait_name: Some(rc!(Mondai)),
block: vec![ block: vec![
FuncDecl { name: rc!(yolo), params: vec![] }, FuncDecl { name: rc!(yolo), params: vec![] },
FuncDecl { name: rc!(swagg), params: vec![] } FuncDecl { name: rc!(swagg), params: vec![] }
] })])); ] })]));
parse_test!("impl Option<WTFMate> { fn oi() }", AST(vec![
Declaration(Impl {
type_name: Singleton { name: rc!(Option), params: vec![ty!("WTFMate")]},
trait_name: None,
block: vec![
FuncDecl { name: rc!(oi), params: vec![] },
]
})]));
} }
#[test] #[test]
fn parsing_type_annotations() { fn parsing_type_annotations() {
parse_test!("const a = b : Int", AST(vec![ parse_test!("const a = b : Int", AST(vec![
Declaration(Binding { name: rc!(a), constant: true, expr: Declaration(Binding { name: rc!(a), constant: true, expr:
Expression(var!("b"), Some(Singleton { Expression(var!("b"), Some(ty!("Int"))) })]));
name: rc!(Int),
params: vec![],
})) })]));
parse_test!("a : Int", AST(vec![ parse_test!("a : Int", AST(vec![
exprstatement!(var!("a"), ty!("Int")) exprstatement!(var!("a"), ty!("Int"))