This repository was archived by the owner on Nov 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathencoding.t
76 lines (57 loc) · 1.51 KB
/
encoding.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# vim:set ft= ts=4 sw=4 et:
use Test::Nginx::Socket::Lua;
use Cwd qw(cwd);
repeat_each(2);
plan tests => repeat_each() * (3 * blocks());
my $pwd = cwd();
our $HttpConfig = qq{
lua_package_path "$pwd/lib/?.lua;;";
};
$ENV{TEST_NGINX_RESOLVER} = '8.8.8.8';
$ENV{TEST_NGINX_KT_PORT} ||= 1978;
#no_long_string();
log_level('notice');
run_tests();
__DATA__
=== TEST 1: value contains "\t"
--- http_config eval: $::HttpConfig
--- config
location /t {
content_by_lua '
local cjson = require "cjson"
local kyototycoon = require "resty.kyototycoon"
local kt = kyototycoon:new()
kt:set_timeout(1000) -- 1 sec
local ok, err = kt:connect("127.0.0.1", $TEST_NGINX_KT_PORT)
if not ok then
ngx.say("failed to connect to kt: ", err)
return
end
local ok, err = kt:set("kyoto", "\ttycoon")
if not ok then
ngx.say("failed to set: ", err)
return
end
ngx.say("set kyoto ok")
local res, err = kt:get("kyoto")
if err then
ngx.say("failed to get kyoto ", err)
return
end
if not res then
ngx.say("kyoto not found.")
return
else
ngx.say("kyoto: ", res)
end
kt:close()
';
}
--- request
GET /t
--- response_body eval
"set kyoto ok
kyoto: \ttycoon
"
--- no_error_log
[error]