Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/inputs-luau-full_moon/if_local.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
if local player = getPlayer() then
print(player.Name)
end

if const player = getPlayer() then
print(player.Name)
end

if local admin = admins:FindFirstChild(name) then
print(admin.Name)
elseif const guest = guests:FindFirstChild(name) then
print(guest.Name)
else
print("unknown")
end

if local x: number? = getValue() then
print(x)
end

local const = 4
if const then
print(const)
end
4 changes: 4 additions & 0 deletions tests/inputs-luau-full_moon/if_local_expression.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
local name = if local player = getPlayer() then player.Name else "Unknown"
local other = if const player = getPlayer() then player.Name else "Unknown"
local label = if local admin = getAdmin() then admin.title elseif const guest = getGuest() then guest.name else "unknown"
local typed = if local x: number = getValue() then x else 0
29 changes: 29 additions & 0 deletions tests/snapshots/tests__luau_full_moon@if_local.lua.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
source: tests/tests.rs
expression: "format(&contents, LuaVersion::Luau)"
input_file: tests/inputs-luau-full_moon/if_local.lua
---
if local player = getPlayer() then
print(player.Name)
end

if const player = getPlayer() then
print(player.Name)
end

if local admin = admins:FindFirstChild(name) then
print(admin.Name)
elseif const guest = guests:FindFirstChild(name) then
print(guest.Name)
else
print("unknown")
end

if local x: number? = getValue() then
print(x)
end

local const = 4
if const then
print(const)
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
source: tests/tests.rs
expression: "format(&contents, LuaVersion::Luau)"
input_file: tests/inputs-luau-full_moon/if_local_expression.lua
---
local name = if local player = getPlayer() then player.Name else "Unknown"
local other = if const player = getPlayer() then player.Name else "Unknown"
local label = if local admin = getAdmin() then admin.title elseif const guest = getGuest() then guest.name else "unknown"
local typed = if local x: number = getValue() then x else 0
Loading