浏览代码

Updated tests to test for newlines in Commands.

Lorenz 7 年前
父节点
当前提交
f19f0f55f7
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14
    0
      hw9/task1/tests/task1.rs

+ 14
- 0
hw9/task1/tests/task1.rs 查看文件

@@ -45,4 +45,18 @@ mod tests {
45 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
 }

正在加载...
取消
保存