Skip to content

Commit 1f0a171

Browse files
committed
Fix analyze test
1 parent d11b449 commit 1f0a171

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

analyze_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,7 @@ func TestAnalyze_lua(t *testing.T) {
19531953
Args: []string{"foo/bar.lua"},
19541954
Line: 5,
19551955
},
1956-
blockCtx{"server"},
1956+
blockCtx{"http", "location"},
19571957
false,
19581958
},
19591959
"lua_shared_dict ok": {
@@ -1998,16 +1998,16 @@ func TestAnalyze_lua(t *testing.T) {
19981998
Args: []string{"$res", "' return 32 + math.cos(32) '"},
19991999
Line: 5,
20002000
},
2001-
blockCtx{"server"},
2001+
blockCtx{"http", "server"},
20022002
false,
20032003
},
2004-
"set_by_lua not ok": {
2004+
"set_by_lua not ok no return value": {
20052005
&Directive{
20062006
Directive: "set_by_lua",
20072007
Args: []string{"' return 32 + math.cos(32) '"},
20082008
Line: 5,
20092009
},
2010-
blockCtx{"http"},
2010+
blockCtx{"http", "server"},
20112011
true,
20122012
},
20132013
"set_by_lua_block ok": {
@@ -2016,25 +2016,25 @@ func TestAnalyze_lua(t *testing.T) {
20162016
Args: []string{"$res", "{ return tonumber(ngx.var.foo) + 1 }"},
20172017
Line: 5,
20182018
},
2019-
blockCtx{"server"},
2019+
blockCtx{"http", "server"},
20202020
false,
20212021
},
2022-
"set_by_lua_block not ok": {
2022+
"set_by_lua_block not ok no return value": {
20232023
&Directive{
20242024
Directive: "set_by_lua_block",
20252025
Args: []string{"{ return tonumber(ngx.var.foo) + 1 }"},
20262026
Line: 5,
20272027
},
2028-
blockCtx{"http"},
2029-
true,
2028+
blockCtx{"http", "server"},
2029+
false,
20302030
},
20312031
"content_by_lua ok": {
20322032
&Directive{
20332033
Directive: "content_by_lua",
20342034
Args: []string{"'ngx.say('I need no extra escaping here, for example: \r\nblah')'"},
20352035
Line: 5,
20362036
},
2037-
blockCtx{"location"},
2037+
blockCtx{"http", "location"},
20382038
false,
20392039
},
20402040
"content_by_lua not ok": {
@@ -2043,7 +2043,7 @@ func TestAnalyze_lua(t *testing.T) {
20432043
Args: []string{"'ngx.say('I need no extra escaping here, for example: \r\nblah')'"},
20442044
Line: 5,
20452045
},
2046-
blockCtx{"http"},
2046+
blockCtx{"http", "location"},
20472047
true,
20482048
},
20492049
"content_by_lua_block ok": {
@@ -2052,7 +2052,7 @@ func TestAnalyze_lua(t *testing.T) {
20522052
Args: []string{"{ngx.say('I need no extra escaping here, for example: \r\nblah')}"},
20532053
Line: 5,
20542054
},
2055-
blockCtx{"location"},
2055+
blockCtx{"http", "server","location"},
20562056
false,
20572057
},
20582058
"content_by_lua_block not ok": {
@@ -2061,7 +2061,7 @@ func TestAnalyze_lua(t *testing.T) {
20612061
Args: []string{"{ngx.say('I need no extra escaping here, for example: \r\nblah')}"},
20622062
Line: 5,
20632063
},
2064-
blockCtx{"http"},
2064+
blockCtx{"http", "location"},
20652065
true,
20662066
},
20672067
}

0 commit comments

Comments
 (0)