#[cfg(test)] mod tests { extern crate task1; use self::task1::Command; use self::task1::ParseError; use self::task1::parse; #[test] fn empty_returns_correct_command() { assert_eq!(parse("\n"), Command::Error(ParseError::EmptyString)) } #[test] fn not_known_command_returns_correct_command() { assert_eq!(parse("Hello"), Command::Error(ParseError::UnknownCommand)) } #[test] fn stage_returns_correct_command() { assert_eq!(parse("STAGE Hello"), Command::Stage("Hello".to_string())) } #[test] fn control_returns_correct_command() { assert_eq!(parse("CONTROL Hello"), Command::Control("Hello".to_string())) } #[test] fn retrieve_returns_correct_command() { assert_eq!(parse("RETRIEVE"), Command::Retrieve) } #[test] fn retrieve_with_arguments_returns_correct_command() { assert_eq!(parse("RETRIEVE Hello"), Command::Retrieve) } }