diff options
Diffstat (limited to 'test/diagnostics/unused-local.lua')
-rw-r--r-- | test/diagnostics/unused-local.lua | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/diagnostics/unused-local.lua b/test/diagnostics/unused-local.lua index 4e8294bf..1faace25 100644 --- a/test/diagnostics/unused-local.lua +++ b/test/diagnostics/unused-local.lua @@ -23,3 +23,64 @@ TEST [[ local <!t!> = {} <!t!>.a = 1 ]] + +TEST [[ +InstanceName = 1 +Instance = _G[InstanceName] +]] + +TEST [[ +local _ = (''):sub(1, 2) +]] + +TEST [[ +local mt, x +function mt:m() + function x:m() + end +end +return mt, x +]] + +TEST [[ +local mt = {} +function mt:f() +end +return mt +]] + +TEST [[ +local <!mt!> = {} +function <!mt!>:f() +end +]] + +TEST [[ +local <!x!> = {} +<!x!>.a = 1 +]] + +TEST [[ +local <!x!> = {} +<!x!>['a'] = 1 +]] + +TEST [[ +local function f(<!self!>) + return 'something' +end +f() +]] + +TEST [[ +local function f(var) + print(var) +end +local var +f(var) +]] + +TEST [[ +local <!t!> = {} +<!t!>[1] = 1 +]] |