Skip to content

Commit

Permalink
Move tests for "if" pseudo-location.
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrSikora committed Dec 23, 2010
1 parent c3372c6 commit 10b55ce
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 109 deletions.
109 changes: 0 additions & 109 deletions t/loc-if.t

This file was deleted.

26 changes: 26 additions & 0 deletions t/output.t
Expand Up @@ -391,3 +391,29 @@ Content-Type: text/plain
--- response_body eval
"\0\3"
--- timeout: 10
=== TEST 18: value - "if" pseudo-location
--- http_config eval: $::http_config
--- config
default_type text/plain;
location /postgres {
if ($arg_foo) {
postgres_pass database;
postgres_query "select * from cats order by id";
postgres_output value 0 0;
break;
}
return 404;
}
--- request
GET /postgres?foo=1
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body chomp
2
--- timeout: 10
51 changes: 51 additions & 0 deletions t/sanity.t
Expand Up @@ -223,3 +223,54 @@ Content-Type: application/x-resty-dbd-stream
--- response_body eval
""
--- timeout: 10
=== TEST 7: "if" pseudo-location
--- http_config eval: $::http_config
--- config
location /postgres {
if ($arg_foo) {
postgres_pass database;
postgres_query "select * from cats";
break;
}
return 404;
}
--- request
GET /postgres?foo=1
--- error_code: 200
--- response_headers
Content-Type: application/x-resty-dbd-stream
--- response_body eval
"\x{00}". # endian
"\x{03}\x{00}\x{00}\x{00}". # format version 0.0.3
"\x{00}". # result type
"\x{00}\x{00}". # std errcode
"\x{02}\x{00}". # driver errcode
"\x{00}\x{00}". # driver errstr len
"". # driver errstr data
"\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}". # rows affected
"\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}". # insert id
"\x{02}\x{00}". # col count
"\x{09}\x{00}". # std col type (integer/int)
"\x{17}\x{00}". # driver col type
"\x{02}\x{00}". # col name len
"id". # col name data
"\x{06}\x{80}". # std col type (varchar/str)
"\x{19}\x{00}". # driver col type
"\x{04}\x{00}". # col name len
"name". # col name data
"\x{01}". # valid row flag
"\x{01}\x{00}\x{00}\x{00}". # field len
"2". # field data
"\x{ff}\x{ff}\x{ff}\x{ff}". # field len
"". # field data
"\x{01}". # valid row flag
"\x{01}\x{00}\x{00}\x{00}". # field len
"3". # field data
"\x{03}\x{00}\x{00}\x{00}". # field len
"bob". # field data
"\x{00}" # row list terminator
--- timeout: 10

0 comments on commit 10b55ce

Please sign in to comment.