Newer
Older
use crate::parse::parse_program;
#[test]
fn binary_ops() {
parse_program("1+1").expect("Failed binary add");
parse_program("1-1").expect("Failed binary sub");
parse_program("1*1").expect("Failed binary mul");
parse_program("1/1").expect("Failed binary div");
parse_program("1%1").expect("Failed binary mod");
}
#[test]
fn unary_ops() {
parse_program("-1").expect("Failed binary inv");
parse_program("!1").expect("Failed binary not");
}
#[test]
fn indentifiers() {
parse_program("let my_ident").expect("Failed declare");
parse_program("let my_ident = 123").expect("Failed declare/assign");
}
#[test]
fn conditional() {
parse_program("if false { }").expect("Failed conditional with literal");
parse_program("if some_ident { }").expect("Failed conditional with identifier");
parse_program("if 1 + 1 { }").expect("Failed conditional with expr");
parse_program("if (let ident = false) { }").expect("Failed conditional with decl");
}