mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Hard code redis.REDIS_VERSION to 7.2.4
Fixes: https://codeberg.org/redict/redict/issues/37 Signed-off-by: Drew DeVault <sir@cmpwn.com>
This commit is contained in:
parent
3d8a3a9ba0
commit
466411d783
@ -1369,6 +1369,15 @@ void luaRegisterVersion(lua_State* lua) {
|
||||
lua_pushstring(lua,"REDICT_VERSION");
|
||||
lua_pushstring(lua,REDICT_VERSION);
|
||||
lua_settable(lua,-3);
|
||||
|
||||
/* Hard-coded to 7.2.4 for forward compatibility: */
|
||||
lua_pushstring(lua,"REDIS_VERSION_NUM");
|
||||
lua_pushnumber(lua,0x070204);
|
||||
lua_settable(lua,-3);
|
||||
|
||||
lua_pushstring(lua,"REDIS_VERSION");
|
||||
lua_pushstring(lua,"7.2.4");
|
||||
lua_settable(lua,-3);
|
||||
}
|
||||
|
||||
void luaRegisterLogFunction(lua_State* lua) {
|
||||
|
@ -1132,6 +1132,26 @@ start_server {tags {"scripting"}} {
|
||||
assert {$v1 eq $v2 || [string match "$v1-r*" $v2]}
|
||||
}
|
||||
|
||||
test {FUNCTION - legacy redis version is hard-coded to 7.2.4} {
|
||||
r FUNCTION load replace {#!lua name=test
|
||||
local version = redis.REDIS_VERSION_NUM
|
||||
|
||||
redict.register_function{function_name='get_version_v1', callback=function()
|
||||
return string.format('%s.%s.%s',
|
||||
bit.band(bit.rshift(version, 16), 0x000000ff),
|
||||
bit.band(bit.rshift(version, 8), 0x000000ff),
|
||||
bit.band(version, 0x000000ff))
|
||||
end}
|
||||
redis.register_function{function_name='get_version_v2', callback=function() return redis.REDIS_VERSION end}
|
||||
}
|
||||
|
||||
catch {[r fcall f1 0]} e
|
||||
set v1 [r fcall get_version_v1 0]
|
||||
set v2 [r fcall get_version_v2 0]
|
||||
# Permanently hard-coded to 7.2.4
|
||||
assert {$v1 eq "7.2.4" && $v1 eq $v2}
|
||||
}
|
||||
|
||||
test {FUNCTION - function stats} {
|
||||
r FUNCTION FLUSH
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user