Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
dndx committed Sep 29, 2024
1 parent 5016b11 commit f31b6c8
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions t/10-prefix.t
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,53 @@ done
[error]
[warn]
[crit]



=== TEST 6: prefix.page() operation
--- ONLY
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
ngx.say(l.db_drop(true))
ngx.say(l.set("test", "value"))
ngx.say(l.set("test1", "value1"))
ngx.say(l.set("test2", "value2"))
ngx.say(l.set("test3", "value3"))
ngx.say(l.set("u", "value4"))
ngx.say(l.set("u1", "value5"))
local p = require("resty.lmdb.prefix")
local res, err = p.page(nil, "test")
if not res then
ngx.say("page errored: ", err)
end
for _, pair in ipairs(res) do
ngx.say("key: ", pair.key, " value: ", pair.value)
end
}
}
--- request
GET /t
--- response_body
true
true
true
true
true
true
true
key: test value: value
key: test1 value: value1
key: test2 value: value2
key: test3 value: value3
--- no_error_log
[error]
[warn]
[crit]

0 comments on commit f31b6c8

Please sign in to comment.