Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcatanzariti committed Feb 9, 2023
1 parent 67d42b9 commit 06b5242
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions src/tests/value_deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,52 +46,28 @@ fn bulk_string() -> Result<()> {
log_try_init();

let result = deserialize_value("$5\r\nhello\r\n")?; // b"hello"
assert_eq!(
Value::BulkString(b"hello".to_vec()),
result
);
assert_eq!(Value::BulkString(b"hello".to_vec()), result);

let result = deserialize_value("$7\r\nhel\r\nlo\r\n")?; // b"hel\r\nlo"
assert_eq!(
Value::BulkString(b"hel\r\nlo".to_vec()),
result
);
assert_eq!(Value::BulkString(b"hel\r\nlo".to_vec()), result);

let result = deserialize_value("$5\r\nhello\r");
assert!(matches!(
result,
Err(Error::Client(description)) if description == "EOF"
));
assert!(matches!(result, Err(Error::EOF)));

let result = deserialize_value("$5\r\nhello");
assert!(matches!(
result,
Err(Error::Client(description)) if description == "EOF"
));
assert!(matches!(result, Err(Error::EOF)));

let result = deserialize_value("$5\r");
assert!(matches!(
result,
Err(Error::Client(description)) if description == "EOF"
));
assert!(matches!(result, Err(Error::EOF)));

let result = deserialize_value("$5");
assert!(matches!(
result,
Err(Error::Client(description)) if description == "EOF"
));
assert!(matches!(result, Err(Error::EOF)));

let result = deserialize_value("$");
assert!(matches!(
result,
Err(Error::Client(description)) if description == "EOF"
));
assert!(matches!(result, Err(Error::EOF)));

let result = deserialize_value("$6\r\nhello\r\n");
assert!(matches!(
result,
Err(Error::Client(description)) if description == "EOF"
));
assert!(matches!(result, Err(Error::EOF)));

Ok(())
}
Expand Down

0 comments on commit 06b5242

Please sign in to comment.