Brak opisu
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 1007B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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!(
  22. parse("CONTROL Hello"),
  23. Command::Control("Hello".to_string())
  24. )
  25. }
  26. #[test]
  27. fn retrieve_returns_correct_command() {
  28. assert_eq!(parse("RETRIEVE"), Command::Retrieve)
  29. }
  30. #[test]
  31. fn retrieve_with_arguments_returns_correct_command() {
  32. assert_eq!(parse("RETRIEVE Hello"), Command::Retrieve)
  33. }
  34. }