summaryrefslogtreecommitdiff
path: root/test/diagnostics/undefined-global.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/diagnostics/undefined-global.lua')
-rw-r--r--test/diagnostics/undefined-global.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/diagnostics/undefined-global.lua b/test/diagnostics/undefined-global.lua
new file mode 100644
index 00000000..f5a6396c
--- /dev/null
+++ b/test/diagnostics/undefined-global.lua
@@ -0,0 +1,36 @@
+TEST [[
+local print, _G
+print(<!x!>)
+print(<!log!>)
+print(<!X!>)
+print(<!Log!>)
+print(<!y!>)
+print(Z)
+print(_G)
+Z = 1
+]]
+
+TEST [[
+X = table[<!x!>]
+]]
+TEST [[
+T1 = 1
+_ENV.T2 = 1
+_G.T3 = 1
+_ENV._G.T4 = 1
+_G._G._G.T5 = 1
+rawset(_G, 'T6', 1)
+rawset(_ENV, 'T7', 1)
+print(T1)
+print(T2)
+print(T3)
+print(T4)
+print(T5)
+print(T6)
+print(T7)
+]]
+
+TEST [[
+---@class c
+c = {}
+]]