mod lex_tests { use relish::ast::{lex}; #[test] fn test_lex_basic_pair() { let document: &str = "(hello 'world')"; let output: &str = "(hello 'world' nil)"; match lex(document.to_string()) { Ok(box_cell) => { assert_eq!(format!("{}", *box_cell), output.to_string()); }, Err(s) => { print!("{}\n", s); assert!(false); } } } #[test] fn test_lex_basic_list() { let document: &str = "(hello 'world' 1 2 3)"; let output: &str = "(hello 'world' 1 2 3 nil)"; match lex(document.to_string()) { Ok(box_cell) => { assert_eq!(format!("{}", *box_cell), output.to_string()); }, Err(s) => { print!("{}\n", s); assert!(false); } } } #[test] fn test_lex_complex_list() { let document: &str = "(hello 'world' (1 2 (1 2 3)) 1 2 3)"; let output: &str = "(hello 'world' (1 2 (1 2 3 nil) nil) 1 2 3 nil)"; match lex(document.to_string()) { Ok(box_cell) => { assert_eq!(format!("{}", *box_cell), output.to_string()); }, Err(s) => { print!("{}\n", s); assert!(false); } } } }