From 2cec52defe43fd58ca8e7f08ada2d48ea1d64bb9 Mon Sep 17 00:00:00 2001 From: Falco Peijnenburg Date: Fri, 29 Dec 2023 13:55:30 +0100 Subject: [PATCH] Fix test cases for previous commit --- tests/golden/data/input/various-comments.lua | 2 ++ tests/golden/data/output/issue-106.lua | 4 +++- tests/golden/data/output/various-comments.lua | 23 ++++++++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/golden/data/input/various-comments.lua b/tests/golden/data/input/various-comments.lua index 09efcf4..15bec2a 100644 --- a/tests/golden/data/input/various-comments.lua +++ b/tests/golden/data/input/various-comments.lua @@ -56,6 +56,8 @@ end local function foo() -- same-line-comment end +-- Rendering of comments after return (or instead of return) reported here: +-- https://github.com/FPtje/GLuaFixer/issues/170#issuecomment-1828253356 function foo() -- Comment before return return 1, 2, 3 -- comment on same line as return diff --git a/tests/golden/data/output/issue-106.lua b/tests/golden/data/output/issue-106.lua index 815c100..b5fe9fb 100644 --- a/tests/golden/data/output/issue-106.lua +++ b/tests/golden/data/output/issue-106.lua @@ -1,5 +1,7 @@ a( {b}, - function() end, -- comment + function() + -- comment + end, function() end ) \ No newline at end of file diff --git a/tests/golden/data/output/various-comments.lua b/tests/golden/data/output/various-comments.lua index 5c68632..c66d017 100644 --- a/tests/golden/data/output/various-comments.lua +++ b/tests/golden/data/output/various-comments.lua @@ -1,6 +1,8 @@ -- Comment before if-statement -if false then end -- same-line comment --- print("TODO") +if false then -- same-line comment + -- print("TODO") +end + if true then a = 2 -- bar end @@ -26,28 +28,33 @@ if true then end -- Comment before if-statement -if true then return end --- comment after return on new line +if true then + return + -- comment after return on new line +end + -- Comment before if-statement if true then return end -- comment after end if true or false then return end --[[ comment in condition]] -- single line comment in condition for var = 1, 10 do -- same-line comment + -- print("TODO") end --- print("TODO") for k, v in pairs(player.GetAll()) do -- same-line comment + -- print("TODO") end --- print("TODO") function foo() -- same-line-comment end local function foo() -- same-line-comment end +-- Rendering of comments after return (or instead of return) reported here: +-- https://github.com/FPtje/GLuaFixer/issues/170#issuecomment-1828253356 function foo() -- Comment before return return 1, 2, 3 -- comment on same line as return -end --- comment after return \ No newline at end of file + -- comment after return +end \ No newline at end of file