mirror of
https://github.com/redis/go-redis.git
synced 2025-10-27 18:15:32 +03:00
* all: Refactor tests for idiomatic Go and minor improvements
Replaced redundant 'for key, _' with 'for key' in map iterations for clarity in doctests/cmds_hash_test.go. Updated time measurement from time.Now().Sub to time.Since in hset_benchmark_test.go for idiomatic Go usage. Simplified variadic argument types from interface{} to any and removed unused min function in maintnotifications/e2e/utils_test.go.
* maintnotifications/e2e/utils_test: Update variadic args type in printLog function
Changed the variadic argument type in printLog from 'any' to 'interface{}' for compatibility and consistency with standard Go practices.
Command examples for redis.io
These examples appear on the Redis documentation site as part of the tabbed examples interface.
How to add examples
- Create a Go test file with a meaningful name in the current folder.
- Create a single method prefixed with
Exampleand write your test in it. - Determine the id for the example you're creating and add it as the first line of the file:
// EXAMPLE: set_and_get. - We're using the Testable Examples feature of Go to test the desired output has been written to stdout.
Special markup
See https://github.com/redis-stack/redis-stack-website#readme for more details.
How to test the examples
- Start a Redis server locally on port 6379
- CD into the
doctestsdirectory - Run
go testto test all examples in the directory. - Run
go test filename.goto test a single file