From 5e5a1b2ebb103625bbbb686ab31abc11a78e9d73 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 17:57:22 +0800 Subject: cleanup tests --- test/diagnostics/unreachable-code.lua | 71 +++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 test/diagnostics/unreachable-code.lua (limited to 'test/diagnostics/unreachable-code.lua') diff --git a/test/diagnostics/unreachable-code.lua b/test/diagnostics/unreachable-code.lua new file mode 100644 index 00000000..4444252f --- /dev/null +++ b/test/diagnostics/unreachable-code.lua @@ -0,0 +1,71 @@ +TEST [[ +if X then + return false +elseif X then + return false +else + return false +end + +]] + +TEST [[ +function X() + if X then + return false + elseif X then + return false + else + return false + end + +end +]] + +TEST [[ +while true do +end + + +]] + +TEST [[ +while true do +end + + +]] + +TEST [[ +while X do + X = 1 +end + +print(1) +]] + +TEST [[ +while true do + if not X then + break + end +end + +print(1) + +do return end +]] + +TEST [[ +local done = false + +local function set_done() + done = true +end + +while not done do + set_done() +end + +print(1) +]] -- cgit v1.2.3