Skip to content

Commit

Permalink
Add more tests for "postgres_escape" directive (including UTF-8 test …
Browse files Browse the repository at this point in the history
…from shrimp).
  • Loading branch information
PiotrSikora committed Jul 23, 2010
1 parent d208187 commit 4abd1bc
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions test/t/escape.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ no_diff();
__DATA__
=== TEST 1: '
--- http_config eval: $::http_config
--- config
location /test {
set $test "he'llo";
Expand All @@ -34,7 +33,6 @@ Content-Type: text/plain
=== TEST 2: \
--- http_config eval: $::http_config
--- config
location /test {
set $test "he\\llo";
Expand All @@ -53,7 +51,6 @@ Content-Type: text/plain
=== TEST 3: \'
--- http_config eval: $::http_config
--- config
location /test {
set $test "he\\'llo";
Expand All @@ -72,7 +69,6 @@ Content-Type: text/plain
=== TEST 4: NULL
--- http_config eval: $::http_config
--- config
location /test {
postgres_escape $escaped $remote_user;
Expand All @@ -86,3 +82,39 @@ Content-Type: text/plain
--- response_body
NULL
--- timeout: 10
=== TEST 5: empty sting
--- config
location /test {
set $empty "";
postgres_escape $escaped $empty;
echo $escaped;
}
--- request
GET /test
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body
''
--- timeout: 10
=== TEST 6: UTF-8
--- config
location /test {
set $utf8 "你好";
postgres_escape $escaped $utf8;
echo $escaped;
}
--- request
GET /test
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body
'你好'
--- timeout: 10

0 comments on commit 4abd1bc

Please sign in to comment.