diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-08-11 17:57:22 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-08-11 17:57:29 +0800 |
commit | 5e5a1b2ebb103625bbbb686ab31abc11a78e9d73 (patch) | |
tree | 8140d6f9c04a51476e558a9b7fa661a068d6c49a /test/diagnostics/unreachable-code.lua | |
parent | cd370225fc4eaf6e2f6baadfb5a8501943c86783 (diff) | |
download | lua-language-server-5e5a1b2ebb103625bbbb686ab31abc11a78e9d73.zip |
cleanup tests
Diffstat (limited to 'test/diagnostics/unreachable-code.lua')
-rw-r--r-- | test/diagnostics/unreachable-code.lua | 71 |
1 files changed, 71 insertions, 0 deletions
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 +<!return true!> +]] + +TEST [[ +function X() + if X then + return false + elseif X then + return false + else + return false + end + <!return true!> +end +]] + +TEST [[ +while true do +end + +<!print(1)!> +]] + +TEST [[ +while true do +end + +<!print(1)!> +]] + +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) +]] |