()
| 80 | |
| 81 | #[test] |
| 82 | fn parse_set_with_ex() { |
| 83 | let value = RespValue::array(vec![ |
| 84 | RespValue::bulk_str("SET"), |
| 85 | RespValue::bulk_str("key"), |
| 86 | RespValue::bulk_str("value"), |
| 87 | RespValue::bulk_str("EX"), |
| 88 | RespValue::bulk_str("60"), |
| 89 | ]); |
| 90 | let cmd = RespCommand::parse(&value).unwrap(); |
| 91 | assert_eq!(cmd.name, "SET"); |
| 92 | assert_eq!(cmd.argc(), 4); |
| 93 | assert_eq!(cmd.arg_str(2), Some("EX")); |
| 94 | assert_eq!(cmd.arg_i64(3), Some(60)); |
| 95 | } |
| 96 | |
| 97 | #[test] |
| 98 | fn parse_empty_array_returns_none() { |