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