-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with latest full-moon test cases
- Loading branch information
1 parent
3d4d07f
commit 2724905
Showing
34 changed files
with
197 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
a = 1 | ||
b = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gui.Label.Text = "LOADING DATA" .. ("."):rep(dotCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
do | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
local foo = x-1 | ||
local foo = x -1 | ||
print(1+-3) | ||
local foo = -x+1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ = 0x02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- comments separated by tab chars, should be parsed as trailing trivia of the tokens they are next to | ||
-- stylua: ignore | ||
local too = { | ||
x, -- string | ||
y, -- string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,15 @@ x += 5 | |
x -= 5 | ||
x *= 5 | ||
x /= 5 | ||
x //= 5 | ||
x %= 5 | ||
x ^= 5 | ||
|
||
x += y | ||
x -= y | ||
x *= y | ||
x /= y | ||
x //= y | ||
x %= y | ||
x ^= y | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Taken from https://github.com/JohnnyMorganz/StyLua/blob/main/tests/inputs/multiline-expressions-3.lua | ||
do | ||
do | ||
do | ||
do | ||
local text = "Players: " .. #Server_Container.ARandomVariableWhichIsVeryLongSoThatThisGetsOverTheColumnLimit.Players_F:GetChildren() - 1 .. "/20" | ||
local ratio = (minAxis - minAxisSize) / delta * (self.props.maxScaleRatio - self.props.minScaleRatio) + self.props.minScaleRatio | ||
local ratio2 = (minAxis - minAxisSize) / delta * (self.props.maxScaleRatio - self.props.minScaleRatio) * self.props.aRandomVariableWhichIsVeryLong + self.props.minScaleRatio | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type TypeOf = | ||
typeof({}) |
3 changes: 3 additions & 0 deletions
3
tests/inputs-luau-full_moon/string_interpolation_regression.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
error( | ||
`a {b} c` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type Foo = { | ||
read bar: number, | ||
write baz: number, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type Config = { | ||
option1: string??, -- you probably need it once in a while | ||
option2: string???, -- once a year | ||
option3: string?????? -- once in your life! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- https://github.com/Kampfkarren/full-moon/issues/286 | ||
|
||
-- should be parsed as a function returning a variable amount of values of type "string & T" | ||
type FnA = () -> ...string & T | ||
|
||
-- should be parsed as an intersection of a function returning U... values, and a value of type T | ||
type FnB<U...> = () -> U... & T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
type Bar = Foo<> | ||
type Bar = Foo<> | ||
type Baz = module.Foo<> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
print("testing \z | ||
twelve") | ||
twelve") | ||
|
||
print("Hello \ | ||
World") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Lua51)" | ||
input_file: tests/inputs-full_moon/assignment-4.lua | ||
--- | ||
a = 1 | ||
b = 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Lua51)" | ||
input_file: tests/inputs-full_moon/assignment-5.lua | ||
--- | ||
gui.Label.Text = "LOADING DATA" .. ("."):rep(dotCount) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Lua51)" | ||
input_file: tests/inputs-full_moon/body-with-spaces.lua | ||
--- | ||
do | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: format(&contents) | ||
expression: "format(&contents, LuaVersion::Lua51)" | ||
input_file: tests/inputs-full_moon/negative-numbers.lua | ||
--- | ||
local foo = x - 1 | ||
local foo = x - 1 | ||
print(1 + -3) | ||
local foo = -x + 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Lua51)" | ||
input_file: tests/inputs-full_moon/numbers-1.lua | ||
--- | ||
_ = 0x02 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Lua51)" | ||
input_file: tests/inputs-full_moon/table-constructors-9.lua | ||
--- | ||
-- comments separated by tab chars, should be parsed as trailing trivia of the tokens they are next to | ||
-- stylua: ignore | ||
local too = { | ||
x, -- string | ||
y, -- string | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/snapshots/tests__luau_full_moon@multiline_expressions.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/multiline_expressions.lua | ||
--- | ||
-- Taken from https://github.com/JohnnyMorganz/StyLua/blob/main/tests/inputs/multiline-expressions-3.lua | ||
do | ||
do | ||
do | ||
do | ||
local text = "Players: " | ||
.. #Server_Container.ARandomVariableWhichIsVeryLongSoThatThisGetsOverTheColumnLimit.Players_F:GetChildren() - 1 | ||
.. "/20" | ||
local ratio = (minAxis - minAxisSize) / delta * (self.props.maxScaleRatio - self.props.minScaleRatio) | ||
+ self.props.minScaleRatio | ||
local ratio2 = (minAxis - minAxisSize) | ||
/ delta | ||
* (self.props.maxScaleRatio - self.props.minScaleRatio) | ||
* self.props.aRandomVariableWhichIsVeryLong | ||
+ self.props.minScaleRatio | ||
end | ||
end | ||
end | ||
end | ||
|
7 changes: 7 additions & 0 deletions
7
tests/snapshots/tests__luau_full_moon@multiline_typeof_regression.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/multiline_typeof_regression.lua | ||
--- | ||
type TypeOf = typeof({}) | ||
|
7 changes: 7 additions & 0 deletions
7
tests/snapshots/tests__luau_full_moon@string_interpolation_regression.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/string_interpolation_regression.lua | ||
--- | ||
error(`a {b} c`) | ||
|
10 changes: 10 additions & 0 deletions
10
tests/snapshots/tests__luau_full_moon@table_access_modifiers.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/table_access_modifiers.lua | ||
--- | ||
type Foo = { | ||
read bar: number, | ||
write baz: number, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/snapshots/tests__luau_full_moon@types_chained_optionals.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/types_chained_optionals.lua | ||
--- | ||
type Config = { | ||
option1: string??, -- you probably need it once in a while | ||
option2: string???, -- once a year | ||
option3: string??????, -- once in your life! | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
tests/snapshots/tests__luau_full_moon@types_compound_precedence.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/types_compound_precedence.lua | ||
--- | ||
-- https://github.com/Kampfkarren/full-moon/issues/286 | ||
|
||
-- should be parsed as a function returning a variable amount of values of type "string & T" | ||
type FnA = () -> ...string & T | ||
|
||
-- should be parsed as an intersection of a function returning U... values, and a value of type T | ||
type FnB<U...> = () -> U... & T | ||
|
5 changes: 2 additions & 3 deletions
5
tests/snapshots/tests__luau_full_moon@types_generic_no_parameters.lua.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
--- | ||
source: tests/tests.rs | ||
assertion_line: 40 | ||
expression: format(&contents) | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/types_generic_no_parameters.lua | ||
|
||
--- | ||
type Bar = Foo<> | ||
type Baz = module.Foo<> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
--- | ||
source: tests/tests.rs | ||
expression: format(&contents) | ||
expression: "format(&contents, LuaVersion::Luau)" | ||
input_file: tests/inputs-luau-full_moon/z-escape-string.lua | ||
--- | ||
print("testing \z | ||
twelve") | ||
|
||
print("Hello \ | ||
World") | ||
|