append_test
Overview
This file contains tests for the APPEND
command in the ironhawk package. It tests various scenarios including appending to new keys, existing keys, and keys with TTLs, as well as error cases.
Detailed Documentation
TestAPPEND(t *testing.T)
Purpose: Tests the APPEND
command with various inputs and scenarios.
Parameters:
t
:*testing.T
- Testing object for running tests.
Returns:
- None
The function defines a series of test cases, each with a name, a list of commands to execute, a list of expected results, and a list of cleanup commands. It iterates through these test cases, executing the commands and verifying that the results match the expected values. It also includes tests for TTL functionality, verifying that appending to keys with TTLs does not reset the TTL.
The test cases cover:
- Appending to a new key.
- Appending to an existing key.
- Appending without an input value (error case).
- Appending an empty string.
- Appending to a key created using
LPUSH
(error case). - Appending with leading zeros.
- Appending to keys created using
SADD
andZADD
(error cases). - Appending after
SET
andDEL
. - Appending to integer values.
- Appending with various data types.
- Appending to a key created using SETBIT