summaryrefslogtreecommitdiff
path: root/grammar/src/tests/mod.rs
blob: 55eedffaa17fb0db75799ab76264ed121d1db8f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[cfg(test)]
mod test_grammar_display {
    use crate::test_grammar_helper::new_grammar;

    #[test]
    fn test_display() -> Result<(), Box<dyn std::error::Error>> {
        new_grammar().map(|g| println!("{g}"))
    }
}

#[cfg(test)]
mod test_grammar_firsts {
    use crate::test_grammar_helper::new_grammar;
    use std::io::Write;

    #[test]
    fn test_firsts() -> Result<(), Box<dyn std::error::Error>> {
        let mut grammar = new_grammar()?;

        grammar.compute_firsts()?;

        let mut lock = std::io::stdout().lock();

        writeln!(lock, "grammar firsts: {:?}", grammar.firsts)?;
        writeln!(lock, "grammar first nodes: {:?}", grammar.first_nodes).map_err(Into::into)
    }
}

#[cfg(test)]
mod test_grammar_left_closure;