checking.rs 629 Bytes
Newer Older
1 2 3
use ast::*;
use errors::*;

4 5
pub fn check_program(program: &Program) -> Result<()> {
    for class in get_program_classes(program) {
6 7
        check_class(class)?;
    }
8
    Ok(())
9 10 11
}

fn check_class(class: &Class) -> Result<()> {
12
    Ok(check_class_items(class)?)
13 14
}

15
fn check_class_items(_class: &Class) -> Result<()> {
16 17 18
    Ok(())
}

19
pub mod tests {
20 21 22 23
    use super::*;

    use ast;

24 25
    pub fn run() -> Result<()> {
        checks_empty_class()
26 27
    }

28
    fn checks_empty_class() -> Result<()> {
29
        let raw = "class Foo {}";
30

31
        let program: ast::Program = ::syn::parse_str(raw)?;
32

33
        check_program(&program)
34 35
    }
}