Mercurial > hg > nginx-tests
changeset 1320:8bd4b88fcac5
Tests: TODO js_return.t fail seen with older njs on some platforms.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 06 Apr 2018 17:21:23 +0300 |
parents | 3b30e97acdcb |
children | 351b95be742b |
files | js_return.t |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/js_return.t +++ b/js_return.t @@ -12,6 +12,8 @@ use strict; use Test::More; +use Config; + BEGIN { use FindBin; chdir($FindBin::Bin); } use lib 'lib'; @@ -41,6 +43,10 @@ http { listen 127.0.0.1:8080; server_name localhost; + location /njs { + js_content test_njs; + } + location / { js_content test_return; } @@ -50,8 +56,11 @@ http { EOF $t->write_file('test.js', <<EOF); + function test_njs(req, res) { + res.return(200, njs.version); + } + function test_return(req, res) { - njs.version; res.return(Number(req.args.c), req.args.t); } @@ -65,6 +74,13 @@ like(http_get('/?c=200'), qr/200 OK.*\x0 like(http_get('/?c=200&t=SEE-THIS'), qr/200 OK.*^SEE-THIS$/ms, 'return text'); like(http_get('/?c=301&t=path'), qr/ 301 .*Location: path/s, 'return redirect'); like(http_get('/?c=404'), qr/404 Not.*html/s, 'return error page'); + +TODO: { +my ($v) = http_get('/njs') =~ /^([.0-9]+)$/m; +local $TODO = 'not yet' unless $v ge '0.2.1' or $Config{archname} !~ /aarch64/; + like(http_get('/?c=inv'), qr/ 500 /, 'return invalid'); +} + ###############################################################################