From 6fe0ea884f692a460cdf084c28900fc44dec0018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 11 Aug 2023 16:28:47 +0800 Subject: cleanup tests --- test/diagnostics/unused-local.lua | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'test/diagnostics/unused-local.lua') 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 = {} .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 = {} +function :f() +end +]] + +TEST [[ +local = {} +.a = 1 +]] + +TEST [[ +local = {} +['a'] = 1 +]] + +TEST [[ +local function f() + return 'something' +end +f() +]] + +TEST [[ +local function f(var) + print(var) +end +local var +f(var) +]] + +TEST [[ +local = {} +[1] = 1 +]] -- cgit v1.2.3