Redsmin / redis-lua-unit

Redis-lua-unit - Framework agnostic unit-testing for Redis Lua scripts
https://redsmin.com
21 stars 7 forks source link

hget throw assert error #5

Open guileen opened 11 years ago

guileen commented 11 years ago

redis.call('hget', 'foo', 'bar')

lua: ./redis-lua-unit/src/commands/hash.lua:22: assertion failed! stack traceback: C: in function 'assert' ./redis-lua-unit/src/commands/hash.lua:22: in function '?' ./redis-lua-unit/src//RedisLua.lua:20: in function 'call' test.lua:10: in main chunk

FGRibreau commented 11 years ago

The issue came from there but I currently don't have the time to look into it. Please note that I'll happily accept pull requests :)

guileen commented 11 years ago

@FGRibreau It's a little complex to mock all redis functions from scratch, like zset is much difficult. I have found a new way to do the redis_mock, I use the redis lua client, and wrap it to mock redis.call,

My pleasure if you can take a look: https://github.com/guileen/redis-extras/blob/master/redis-mock.lua#L28-L40

FGRibreau commented 11 years ago

Nice catch!

But it means you will need a running Redis server, so it may not always be the simplest solution. I'll keep the ticket open for further updates.