Browse Source

Updated tests to test for newlines in Commands.

Lorenz 7 years ago
parent
commit
f19f0f55f7
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      hw9/task1/tests/task1.rs

+ 14
- 0
hw9/task1/tests/task1.rs View File

45
         assert_eq!(parse("RETRIEVE Hello\n"), Ok(Command::Retrieve))
45
         assert_eq!(parse("RETRIEVE Hello\n"), Ok(Command::Retrieve))
46
     }
46
     }
47
 
47
 
48
+    #[test]
49
+    fn stage_with_newline_returns_correct_command() {
50
+        assert_eq!(parse("STAGE 123\n456"), Ok(Command::Stage("123".to_string())))
51
+    }
52
+
53
+    #[test]
54
+    fn control_with_newline_returns_correct_command() {
55
+        assert_eq!(parse("Control 123\n456"), Ok(Command::Control("123".to_string())))
56
+    }
57
+
58
+    #[test]
59
+    fn retrieve_with_newline_returns_correct_command() {
60
+        assert_eq!(parse("RETRIEVE 123\n456"), Ok(Command::Retrieve))
61
+    }
48
 }
62
 }

Loading…
Cancel
Save