File: 164-say.t

package info (click to toggle)
libnginx-mod-http-lua 1%3A0.10.28-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,456 kB
  • sloc: ansic: 42,658; perl: 480; sh: 303; python: 23; makefile: 11
file content (111 lines) | stat: -rw-r--r-- 1,777 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# vim:set ft= ts=4 sw=4 et fdm=marker:

use Test::Nginx::Socket::Lua;

repeat_each(2);

plan tests => blocks() * repeat_each() * 2;

run_tests();

__DATA__

=== TEST 1: ngx.say (integer)
--- config
    location /lua {
        content_by_lua_block {
            ngx.say(2)
        }
    }
--- request
GET /lua
--- response_body
2



=== TEST 2: ngx.say (floating point number)
the maximum number of significant digits is 14 in lua
--- config
    location /lua {
        content_by_lua_block {
            ngx.say(3.1415926)
            ngx.say(3.14159265357939723846)
        }
    }
--- request
GET /lua
--- response_body
3.1415926
3.1415926535794



=== TEST 3: ngx.say (table with number)
--- config
    location /lua {
        content_by_lua_block {
            local data = {123," ", 3.1415926}
            ngx.say(data)
        }
    }
--- request
GET /lua
--- response_body
123 3.1415926



=== TEST 4: ngx.say min int32 -2147483648
--- config
    location /lua {
        content_by_lua_block {
            ngx.say(-2147483648)
        }
    }
--- request
GET /lua
--- response_body
-2147483648



=== TEST 5: ngx.say big integer 2147483647
--- config
    location /lua {
        content_by_lua_block {
            ngx.say(2147483647)
        }
    }
--- request
GET /lua
--- response_body
2147483647



=== TEST 6: ngx.say big integer -9223372036854775808
--- config
    location /lua {
        content_by_lua_block {
            ngx.say(-9223372036854775808)
        }
    }
--- request
GET /lua
--- response_body
-9.2233720368548e+18



=== TEST 7: ngx.say big integer 18446744073709551615
--- config
    location /lua {
        content_by_lua_block {
            ngx.say(18446744073709551615)
        }
    }
--- request
GET /lua
--- response_body
1.844674407371e+19