瀏覽代碼

Added even more tests. Should be fine now.

Lorenz 7 年之前
父節點
當前提交
f5c10877e4
共有 1 個檔案被更改,包括 10 行新增0 行删除
  1. 10
    0
      hw9/task1/tests/task1.rs

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

@@ -45,6 +45,16 @@ mod tests {
45 45
         assert_eq!(parse("RETRIEVE Hello\n"), Ok(Command::Retrieve))
46 46
     }
47 47
 
48
+    #[test]
49
+    fn empty_with_newline_returns_correct_command() {
50
+        assert_eq!(parse("\n12341234\n"), Err(ParseError(ErrorType::EmptyString)))
51
+    }
52
+
53
+    #[test]
54
+    fn not_known_command_with_newline_returns_correct_command() {
55
+        assert_eq!(parse("Hello\n123\n"), Err(ParseError(ErrorType::UnknownCommand)))
56
+    }
57
+
48 58
     #[test]
49 59
     fn stage_with_newline_returns_correct_command() {
50 60
         assert_eq!(parse("STAGE 123\n456"), Ok(Command::Stage("123".to_string())))

Loading…
取消
儲存