Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

task1.rs 973B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #[cfg(test)]
  2. mod tests {
  3. extern crate task1;
  4. use self::task1::Command;
  5. use self::task1::ParseError;
  6. use self::task1::parse;
  7. #[test]
  8. fn empty_returns_correct_command() {
  9. assert_eq!(parse("\n"), Command::Error(ParseError::EmptyString))
  10. }
  11. #[test]
  12. fn not_known_command_returns_correct_command() {
  13. assert_eq!(parse("Hello"), Command::Error(ParseError::UnknownCommand))
  14. }
  15. #[test]
  16. fn stage_returns_correct_command() {
  17. assert_eq!(parse("STAGE Hello"), Command::Stage("Hello".to_string()))
  18. }
  19. #[test]
  20. fn control_returns_correct_command() {
  21. assert_eq!(parse("CONTROL Hello"), Command::Control("Hello".to_string()))
  22. }
  23. #[test]
  24. fn retrieve_returns_correct_command() {
  25. assert_eq!(parse("RETRIEVE"), Command::Retrieve)
  26. }
  27. #[test]
  28. fn retrieve_with_arguments_returns_correct_command() {
  29. assert_eq!(parse("RETRIEVE Hello"), Command::Retrieve)
  30. }
  31. }