diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_commands.rs | 16 | ||||
| -rw-r--r-- | tests/test_parse_bulk_string.rs | 2 | ||||
| -rw-r--r-- | tests/test_parse_double.rs | 1 |
3 files changed, 8 insertions, 11 deletions
diff --git a/tests/test_commands.rs b/tests/test_commands.rs index 1031c8b..e71db38 100644 --- a/tests/test_commands.rs +++ b/tests/test_commands.rs @@ -37,13 +37,13 @@ mod command_parser_tests { #[test] fn test_parse_ping() { let cmd = build_command_from_str_slice(&["PING"]); - assert!(matches!(RedisCommands::from(cmd), RedisCommands::PING)); + assert!(matches!(RedisCommands::from(cmd), RedisCommands::Ping)); } #[test] fn test_parse_ping_case_insensitive() { let cmd = build_command_from_str_slice(&["pInG"]); - assert!(matches!(RedisCommands::from(cmd), RedisCommands::PING)); + assert!(matches!(RedisCommands::from(cmd), RedisCommands::Ping)); } #[test] @@ -56,7 +56,7 @@ mod command_parser_tests { fn test_parse_echo() { let cmd = build_command_from_str_slice(&["ECHO", "hello world"]); match RedisCommands::from(cmd) { - RedisCommands::ECHO(s) => assert_eq!(s, "hello world"), + RedisCommands::Echo(s) => assert_eq!(s, "hello world"), _ => panic!("Expected ECHO command"), } } @@ -71,7 +71,7 @@ mod command_parser_tests { fn test_parse_get() { let cmd = build_command_from_str_slice(&["GET", "mykey"]); match RedisCommands::from(cmd) { - RedisCommands::GET(k) => assert_eq!(k, "mykey"), + RedisCommands::Get(k) => assert_eq!(k, "mykey"), _ => panic!("Expected GET command"), } } @@ -80,7 +80,7 @@ mod command_parser_tests { fn test_parse_simple_set() { let cmd = build_command_from_str_slice(&["SET", "mykey", "myvalue"]); match RedisCommands::from(cmd) { - RedisCommands::SET(c) => { + RedisCommands::Set(c) => { assert_eq!(c.key, "mykey"); assert_eq!(c.value, "myvalue"); assert!(c.condition.is_none() && c.expiry.is_none() && !c.get_old_value); @@ -93,7 +93,7 @@ mod command_parser_tests { fn test_parse_set_with_all_options() { let cmd = build_command_from_str_slice(&["SET", "k", "v", "NX", "PX", "5000", "GET"]); match RedisCommands::from(cmd) { - RedisCommands::SET(c) => { + RedisCommands::Set(c) => { assert!(matches!(c.condition, Some(SetCondition::NotExists))); assert!(matches!(c.expiry, Some(ExpiryOption::Milliseconds(5000)))); assert!(c.get_old_value); @@ -106,7 +106,7 @@ mod command_parser_tests { fn test_parse_set_options_case_insensitive() { let cmd = build_command_from_str_slice(&["set", "k", "v", "nx", "px", "100"]); match RedisCommands::from(cmd) { - RedisCommands::SET(c) => { + RedisCommands::Set(c) => { assert!(matches!(c.condition, Some(SetCondition::NotExists))); assert!(matches!(c.expiry, Some(ExpiryOption::Milliseconds(100)))); } @@ -267,8 +267,6 @@ mod set_command_tests { use codecrafters_redis::resp_commands::{ExpiryOption, SetCommand}; - use super::*; - #[test] fn test_calculate_expiry_seconds() { let cmd = diff --git a/tests/test_parse_bulk_string.rs b/tests/test_parse_bulk_string.rs index 1543262..a247b6e 100644 --- a/tests/test_parse_bulk_string.rs +++ b/tests/test_parse_bulk_string.rs @@ -30,7 +30,7 @@ fn test_valid_bulk_strings() { // large string let large_content = "x".repeat(1000); let large_bulk = format!("$1000\r\n{}\r\n", large_content); - if let RespType::BulkString(bulk) = parse_bulk_strings(large_bulk.as_bytes()).unwrap().0 {} + if let RespType::BulkString(_) = parse_bulk_strings(large_bulk.as_bytes()).unwrap().0 {} assert_eq!( parse_bulk_strings(large_bulk.as_bytes()).unwrap().0, diff --git a/tests/test_parse_double.rs b/tests/test_parse_double.rs index f8fa550..e69de29 100644 --- a/tests/test_parse_double.rs +++ b/tests/test_parse_double.rs @@ -1 +0,0 @@ -use codecrafters_redis::resp_parser::*; |
