File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use Test::Nginx::Socket::Lua;
99
1010repeat_each(2 );
1111
12- plan tests => repeat_each() * (blocks() * 2 + 15 );
12+ plan tests => repeat_each() * (blocks() * 2 + 16 );
1313
1414# no_diff();
1515no_long_string();
@@ -1129,27 +1129,33 @@ failed to match
11291129
11301130
11311131
1132- === TEST 48: init_by_lua
1132+ === TEST 48: init_by_lua_block
11331133--- http_config
1134- init_by_lua '
1135- package.loaded.m = ngx.re.match(" hello, 1234 " , " (\\\\d+ )" )
1136- ';
1134+ init_by_lua_block {
1135+ local m , err = ngx. re. match("hello, 1234" , [[(\d+ )]])
1136+ if not m then
1137+ ngx. log (ngx. ERR, " failed to match: " , err)
1138+ else
1139+ package. loaded. m = m
1140+ end
1141+ }
11371142--- config
11381143 location /re {
1139- content_by_lua '
1144+ content_by_lua_block {
11401145 local m = package. loaded. m
11411146 if m then
11421147 ngx. say(m[0])
11431148 else
11441149 ngx. say("not matched!" )
11451150 end
1146- ' ;
1151+ }
11471152 }
11481153--- request
11491154 GET /re
11501155--- response_body
115111561234
1152- --- SKIP
1157+ --- no_error_log
1158+ [error]
11531159
11541160
11551161
You can’t perform that action at this time.
0 commit comments