暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

srv-commands.rs 1003B

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