Skip to content

Commit

Permalink
Add support to casting RedisResult to CString.
Browse files Browse the repository at this point in the history
  • Loading branch information
nihohit authored and shachlanAmazon committed Aug 18, 2022
1 parent 16794e3 commit 0572b16
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions redis/tests/test_types.rs
Expand Up @@ -211,6 +211,10 @@ fn test_cstring() {
let v: RedisResult<CString> = FromRedisValue::from_redis_value(&Value::Okay);
assert_eq!(v, Ok(CString::new("OK").unwrap()));

let v: RedisResult<CString> =
FromRedisValue::from_redis_value(&Value::Status("gar\0bage".into()));
assert_eq!(v.unwrap_err().kind(), ErrorKind::TypeError);

let v: RedisResult<CString> = FromRedisValue::from_redis_value(&Value::Nil);
assert_eq!(v.unwrap_err().kind(), ErrorKind::TypeError);

Expand Down

0 comments on commit 0572b16

Please sign in to comment.