comparison stream_js_object.t @ 1614:bc0990ea2e5b

Tests: js TODO adjusted up to 0.4.0.
author Dmitry Volyntsev <xeioex@nginx.com>
date Tue, 17 Nov 2020 17:49:16 +0000
parents f3ba4c74de31
children 18ac4d9e5a2a
comparison
equal deleted inserted replaced
1613:d7ec131d305a 1614:bc0990ea2e5b
21 ############################################################################### 21 ###############################################################################
22 22
23 select STDERR; $| = 1; 23 select STDERR; $| = 1;
24 select STDOUT; $| = 1; 24 select STDOUT; $| = 1;
25 25
26 my $t = Test::Nginx->new()->has(qw/http stream stream_return/) 26 my $t = Test::Nginx->new()->has(qw/stream stream_return/)
27 ->write_file_expand('nginx.conf', <<'EOF'); 27 ->write_file_expand('nginx.conf', <<'EOF');
28 28
29 %%TEST_GLOBALS%% 29 %%TEST_GLOBALS%%
30 30
31 daemon off; 31 daemon off;
32 32
33 events { 33 events {
34 }
35
36 http {
37 %%TEST_GLOBALS_HTTP%%
38
39 js_include test.js;
40
41 server {
42 listen 127.0.0.1:8080;
43 server_name localhost;
44
45 location /njs {
46 js_content test_njs;
47 }
48 }
49 } 34 }
50 35
51 stream { 36 stream {
52 %%TEST_GLOBALS_STREAM%% 37 %%TEST_GLOBALS_STREAM%%
53 38
62 } 47 }
63 48
64 EOF 49 EOF
65 50
66 $t->write_file('test.js', <<EOF); 51 $t->write_file('test.js', <<EOF);
67 function test_njs(r) {
68 r.return(200, njs.version);
69 }
70
71 function to_string(s) { 52 function to_string(s) {
72 return s.toString() === '[object Stream Session]'; 53 return s.toString() === '[object Stream Session]';
73 } 54 }
74 55
75 function define_prop(s) { 56 function define_prop(s) {
108 89
109 $t->try_run('no njs stream session object')->plan(1); 90 $t->try_run('no njs stream session object')->plan(1);
110 91
111 ############################################################################### 92 ###############################################################################
112 93
113 TODO: {
114 local $TODO = 'not yet'
115 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.4.0';
116
117 is(stream('127.0.0.1:' . port(8081))->read(), 'true400', 'var set'); 94 is(stream('127.0.0.1:' . port(8081))->read(), 'true400', 'var set');
118 95
119 }
120
121 ############################################################################### 96 ###############################################################################