mirror of
https://github.com/Reuh/candran.git
synced 2026-02-04 10:18:38 +00:00
Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dc6ad3cf5 |
1 changed files with 12 additions and 11 deletions
|
|
@ -1157,20 +1157,21 @@ foo = 12
|
|||
]])
|
||||
if _VERSION >= "Lua 5.5" then
|
||||
test("global variable declaration", [[
|
||||
do
|
||||
global foo
|
||||
global <const> bar
|
||||
end
|
||||
foo = 42
|
||||
assert(not pcall(function() foo = 42 end))
|
||||
global foo = 42
|
||||
]])
|
||||
test("global variable declaration with error", [[
|
||||
global foo = 42
|
||||
bar = 12
|
||||
]], { "loadError", "variable 'bar' not declared" })
|
||||
test("global variable declaration with attribute", [[
|
||||
global <const> bar
|
||||
bar = 42
|
||||
]], { "loadError", "attempt to assign to const variable 'bar'" })
|
||||
test("collective global variable declaration with attribute", [[
|
||||
foo = 42
|
||||
do
|
||||
global<const> *
|
||||
end
|
||||
assert(not pcall(function() foo = 12 end))
|
||||
]])
|
||||
foo = 12
|
||||
]], { "loadError", "attempt to assign to const variable 'foo'" })
|
||||
end
|
||||
|
||||
-- bitwise operators
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue