Skip to content

Commit

Permalink
Add precise stds for Lua libs
Browse files Browse the repository at this point in the history
TODO: more prexise definition of ngx_lua and busted stds
TODO: change _G std to equal to std of currently used Lua version
  • Loading branch information
mpeterv committed Feb 27, 2017
1 parent a9e2e36 commit ccd379a
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 110 deletions.
6 changes: 3 additions & 3 deletions spec/cli_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ Total: 1 warning / 0 errors in 1 file
Checking spec/samples/read_globals.lua 5 warnings
spec/samples/read_globals.lua:1:1: setting read-only global variable 'string'
spec/samples/read_globals.lua:2:1: setting read-only field 'append' of global 'table'
spec/samples/read_globals.lua:2:1: setting undefined field 'append' of global 'table'
spec/samples/read_globals.lua:5:1: setting read-only global variable 'bar'
spec/samples/read_globals.lua:6:1: mutating non-standard global variable 'baz'
spec/samples/read_globals.lua:6:21: accessing undefined variable 'baz'
Expand All @@ -598,7 +598,7 @@ Total: 5 warnings / 0 errors in 1 file
Checking spec/samples/indirect_globals.lua 3 warnings
spec/samples/indirect_globals.lua:2:11-16: accessing undefined variable 'global'
spec/samples/indirect_globals.lua:5:1-8: indirectly setting read-only field 'concat.foo.bar' of global 'table'
spec/samples/indirect_globals.lua:5:1-8: indirectly setting undefined field 'concat.foo.bar' of global 'table'
spec/samples/indirect_globals.lua:5:32-37: accessing undefined variable 'global'
Total: 3 warnings / 0 errors in 1 file
Expand All @@ -621,7 +621,7 @@ Total: 2 warnings / 0 errors in 1 file
Checking spec/samples/read_globals.lua 5 warnings
spec/samples/read_globals.lua:1:1: (W121) setting read-only global variable 'string'
spec/samples/read_globals.lua:2:1: (W122) setting read-only field 'append' of global 'table'
spec/samples/read_globals.lua:2:1: (W142) setting undefined field 'append' of global 'table'
spec/samples/read_globals.lua:5:1: (W121) setting read-only global variable 'bar'
spec/samples/read_globals.lua:6:1: (W112) mutating non-standard global variable 'baz'
spec/samples/read_globals.lua:6:21: (W113) accessing undefined variable 'baz'
Expand Down
4 changes: 3 additions & 1 deletion spec/options_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ describe("options", function()
assert.is_same({read_only = false, other_fields = true}, std.fields.bar)
assert.is_nil(std.fields.baz)
assert.is_same({read_only = true, deep_read_only = true, other_fields = true}, std.fields.quux)
assert.is_same({other_fields = true, deep_read_only = true}, std.fields.string)
assert.is_table(std.fields.string)
assert.is_true(std.fields.string.deep_read_only)
assert.is_nil(std.fields.string.other_fields)
end)

it("considers read-only and regular field definitions", function()
Expand Down
Loading

0 comments on commit ccd379a

Please sign in to comment.