comparison js_return.t @ 1751:18ac4d9e5a2a

Tests: rewriting njs tests without deprecated "js_include".
author Dmitry Volyntsev <xeioex@nginx.com>
date Thu, 09 Dec 2021 17:36:29 +0000
parents bc0990ea2e5b
children
comparison
equal deleted inserted replaced
1750:b28f88e352dd 1751:18ac4d9e5a2a
35 } 35 }
36 36
37 http { 37 http {
38 %%TEST_GLOBALS_HTTP%% 38 %%TEST_GLOBALS_HTTP%%
39 39
40 js_include test.js; 40 js_import test.js;
41 41
42 server { 42 server {
43 listen 127.0.0.1:8080; 43 listen 127.0.0.1:8080;
44 server_name localhost; 44 server_name localhost;
45 45
46 location / { 46 location / {
47 js_content test_return; 47 js_content test.returnf;
48 } 48 }
49 } 49 }
50 } 50 }
51 51
52 EOF 52 EOF
53 53
54 $t->write_file('test.js', <<EOF); 54 $t->write_file('test.js', <<EOF);
55 function test_return(r) { 55 function returnf(r) {
56 r.return(Number(r.args.c), r.args.t); 56 r.return(Number(r.args.c), r.args.t);
57 } 57 }
58
59 export default {returnf};
58 60
59 EOF 61 EOF
60 62
61 $t->try_run('no njs return')->plan(5); 63 $t->try_run('no njs return')->plan(5);
62 64