Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlightIbuki committed Nov 21, 2024
1 parent 3002207 commit 5c0a4b7
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions t/10-prefix.t
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,6 @@ key: test3 value: value3
for _, pair in ipairs(res) do
ngx.say("key: ", pair.key, " value: ", pair.value)
end
ngx.say("PAGE SIZE 1")
res, err = p.page("test", "test", nil, 1)
if not res then
ngx.say("page errored: ", err)
end
assert(#res == 1)
ngx.say(res[1].key, " ", res[1].value)
}
}
--- request
Expand All @@ -330,8 +321,53 @@ key: test1 value: value1
SECOND PAGE
key: test2 value: value2
key: test3 value: value3
--- no_error_log
[error]
[warn]
[crit]



=== TEST 8: prefix.page() operation with invalid page size
--- 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"))
ngx.say("PAGE SIZE 1")
res = assert(p.page("test", "test", nil, 1))
assert(#res == 1)
ngx.say(res[1].key, " ", res[1].value)
ngx.say("PAGE SIZE 2")
res, more = p.page("test", "test", nil, 2)
assert(more)
assert(#res == 2)
for _, pair in ipairs(res) do
ngx.say(pair.key, " ", pair.value)
end
}
}
--- request
GET /t
--- response_body
PAGE SIZE 1
test value
PAGE SIZE 2
test value
test1 value1
--- no_error_log
[error]
[warn]
Expand Down

0 comments on commit 5c0a4b7

Please sign in to comment.