Skip to main content

getdel_test.go

getdel_test.go - Overview

This file contains tests for the GETDEL command in the Ironhawk package. It tests various scenarios, including retrieving and deleting a key, handling expiration, and invalid command usage.

Detailed Documentation

TestGETDEL Function

Purpose: Tests the functionality of the GETDEL command. It sets up a local connection to the database, defines a series of test cases with different commands and expected outcomes, and then executes these test cases.

Parameters:

  • t (*testing.T): The testing object, used for reporting test failures and other test-related functions.

Returns:

  • None

The test cases cover scenarios such as:

  • Basic GETDEL operation
  • GETDEL with key expiration
  • GETDEL when the key is expired
  • GETDEL with incorrect number of arguments

TestCase Struct

The TestCase struct is not defined in this file. It is assumed to be defined elsewhere and used for structuring the test cases. From the usage, it likely has the following fields:

  • name (string): Name of the test case.
  • commands ([]string): List of commands to execute.
  • expected ([]interface{}): Expected results for each command.
  • delay ([]time.Duration): Delay to introduce before executing each command (optional).

getLocalConnection Function

The getLocalConnection function is not defined in this file. It is assumed to be defined elsewhere and returns a client connection to a local database instance.

runTestcases Function

The runTestcases function is not defined in this file. It is assumed to be defined elsewhere and is used to execute the defined test cases against the database client, comparing the actual results with the expected results and reporting any discrepancies.

Getting Started Relevance