use dust_lang::*; #[test] fn format_simple_program() { let mut interpreter = Interpreter::new(Map::new()); interpreter.run("x=1").unwrap(); assert_eq!(interpreter.format(), "x = 1\n"); } const FORMATTED_BLOCK: &str = "{ 1 2 3 } "; #[test] fn format_block() { let mut interpreter = Interpreter::new(Map::new()); interpreter.run("{1 2 3}").unwrap(); assert_eq!(FORMATTED_BLOCK, interpreter.format()); } const FORMATTED_MAP: &str = "{ { x = 1 y = 2 } } "; #[test] fn format_map() { let mut interpreter = Interpreter::new(Map::new()); interpreter.run("{{x=1 y = 2}}").unwrap(); assert_eq!(FORMATTED_MAP, interpreter.format()); } const FORMATTED_FUNCTION: &str = "(x ) { x / 2 } "; #[test] fn format_function() { let mut interpreter = Interpreter::new(Map::new()); interpreter.run("( x< int > ){x/2}").unwrap(); assert_eq!(FORMATTED_FUNCTION, interpreter.format()); }