mirror of
https://github.com/pesde-pkg/tooling.git
synced 2025-05-04 10:43:58 +01:00
test: cover all tools
This commit is contained in:
parent
e3c4215569
commit
f09a1149ad
20 changed files with 190 additions and 5 deletions
6
bins/argon/tests/input.project.json
Normal file
6
bins/argon/tests/input.project.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "good-input",
|
||||
"tree": {
|
||||
"$path": "../"
|
||||
}
|
||||
}
|
12
bins/argon/tests/run.luau
Normal file
12
bins/argon/tests/run.luau
Normal file
|
@ -0,0 +1,12 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.args = { "sourcemap", "bins/argon/tests/input.project.json", "--output bins/argon/tests/output/sourcemap.json" }
|
||||
local success, err = pcall(require, "bins/argon/init.luau")
|
||||
assert(success, `failed to execute argon: {err}`)
|
||||
|
||||
assert(fs.isFile("bins/argon/tests/output/sourcemap.luau"), `output not found`)
|
||||
end
|
10
bins/asphalt/tests/asphalt.toml
Normal file
10
bins/asphalt/tests/asphalt.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[inputs.assets]
|
||||
path = "input/**"
|
||||
output_path = "output"
|
||||
|
||||
[creator]
|
||||
type = "user"
|
||||
id = 0
|
||||
|
||||
[codegen]
|
||||
output_name = "init.luau"
|
BIN
bins/asphalt/tests/input/water_normal_map.png
Normal file
BIN
bins/asphalt/tests/input/water_normal_map.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
13
bins/asphalt/tests/run.luau
Normal file
13
bins/asphalt/tests/run.luau
Normal file
|
@ -0,0 +1,13 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.cwd = "bins/asphalt" -- bcuz asphalt.toml must to be in the same directory
|
||||
-- process.args = { "sync", "--target debug" }
|
||||
local success, err = pcall(require, "bins/asphalt/init.luau")
|
||||
assert(success, `failed to execute asphalt: {err}`)
|
||||
|
||||
assert(fs.isFile("bins/asphalt/tests/output/water_normal_map.png"), "uploaded asset not found")
|
||||
end
|
9
bins/blink/tests/input.blink
Normal file
9
bins/blink/tests/input.blink
Normal file
|
@ -0,0 +1,9 @@
|
|||
option ClientOutput = "test/output/client.luau"
|
||||
option ServerOutput = "test/output/server.luau"
|
||||
|
||||
event MyFirstEvent {
|
||||
from: Server,
|
||||
type: Reliable,
|
||||
call: SingleSync,
|
||||
data: string
|
||||
}
|
16
bins/blink/tests/run.luau
Normal file
16
bins/blink/tests/run.luau
Normal file
|
@ -0,0 +1,16 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.args = { "bins/blink/tests/input.blink" }
|
||||
local success, err = pcall(require, "bins/blink/init.luau")
|
||||
assert(success, `failed to execute blink: {err}`)
|
||||
|
||||
local client_signature = `\n-- File generated by Blink v{version}`
|
||||
assert(fs.readFile("bins/blink/tests/output/client.luau"):match(client_signature), `invalid output`)
|
||||
|
||||
local server_signature = `\n-- File generated by Blink v{version}`
|
||||
assert(fs.readFile("bins/blink/tests/output/server.luau"):match(server_signature), `invalid output`)
|
||||
end
|
8
bins/darklua/tests/input.luau
Normal file
8
bins/darklua/tests/input.luau
Normal file
|
@ -0,0 +1,8 @@
|
|||
opt server_output = "tests/output/server.luau"
|
||||
opt client_output = "tests/output/client.luau"
|
||||
|
||||
funct Test = {
|
||||
call: Async,
|
||||
args: (Foo: u8, Bar: string),
|
||||
rets: enum { Success, Fail }
|
||||
}
|
16
bins/darklua/tests/run.luau
Normal file
16
bins/darklua/tests/run.luau
Normal file
|
@ -0,0 +1,16 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.args = { "bins/zap/tests/input.zap" }
|
||||
local success, err = pcall(require, "bins/blink/init.luau")
|
||||
assert(success, `failed to execute blink: {err}`)
|
||||
|
||||
local client_signature = `\n-- Client generated by Zap v{version} (https://github.com/red-blox/zap)`
|
||||
assert(fs.readFile("tests/output/client.luau"):match(client_signature), `invalid output`)
|
||||
|
||||
local server_signature = `\n-- Server generated by Zap v{version} (https://github.com/red-blox/zap)`
|
||||
assert(fs.readFile("tests/output/server.luau"):match(server_signature), `invalid output`)
|
||||
end
|
1
bins/luau-lsp/tests/input.luau
Normal file
1
bins/luau-lsp/tests/input.luau
Normal file
|
@ -0,0 +1 @@
|
|||
local a: string = 1
|
15
bins/luau-lsp/tests/run.luau
Normal file
15
bins/luau-lsp/tests/run.luau
Normal file
|
@ -0,0 +1,15 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.args = { "process bins/darklua/tests/input.luau bins/darklua/tests/output.luau" --format dense }
|
||||
local success, result = pcall(require, "bins/darklua/init.luau")
|
||||
assert(success, `failed to execute darklua: {result}`)
|
||||
|
||||
assert(
|
||||
fs.readFile("bins/darklua/tests/output.luau") ~= fs.readFile("bins/darklua/tests/input.luau"),
|
||||
`any expected error was found: {result}`
|
||||
)
|
||||
end
|
6
bins/rojo/tests/input.project.json
Normal file
6
bins/rojo/tests/input.project.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "good-input",
|
||||
"tree": {
|
||||
"$path": "../"
|
||||
}
|
||||
}
|
12
bins/rojo/tests/run.luau
Normal file
12
bins/rojo/tests/run.luau
Normal file
|
@ -0,0 +1,12 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.args = { "sourcemap", "bins/rojo/tests/input.project.json", "--output bins/rojo/tests/output/sourcemap.json" }
|
||||
local success, err = pcall(require, "bins/rojo/init.luau")
|
||||
assert(success, `failed to execute rojo: {err}`)
|
||||
|
||||
assert(fs.isFile("bins/rojo/tests/output/sourcemap.luau"), `output not found`)
|
||||
end
|
3
bins/selene/tests/bad_input.luau
Normal file
3
bins/selene/tests/bad_input.luau
Normal file
|
@ -0,0 +1,3 @@
|
|||
if {} == {} then
|
||||
error("impossible")
|
||||
end
|
3
bins/selene/tests/good_input.luau
Normal file
3
bins/selene/tests/good_input.luau
Normal file
|
@ -0,0 +1,3 @@
|
|||
if 1 == 1 then
|
||||
print("always true")
|
||||
end
|
28
bins/selene/tests/run.luau
Normal file
28
bins/selene/tests/run.luau
Normal file
|
@ -0,0 +1,28 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
|
||||
return function(version)
|
||||
do
|
||||
-- not working, needing support
|
||||
-- process.args = { "bins/selene/tests/bad_input.luau" }
|
||||
local success, result = pcall(require, "bins/selene/init.luau")
|
||||
assert(success, `failed to execute selene: {result}`)
|
||||
|
||||
assert(
|
||||
string.find(result, "%d warnings") or string.find(result, "%d errors"),
|
||||
`any expected error was found: {result}`
|
||||
)
|
||||
end
|
||||
|
||||
do
|
||||
-- not working, needing support
|
||||
-- process.args = { "bins/selene/tests/good_input.luau" }
|
||||
local success, result = pcall(require, "bins/selene/init.luau")
|
||||
assert(success, `failed to execute selene: {result}`)
|
||||
|
||||
assert(
|
||||
string.find(result, "0 warnings") or string.find(result, "0 errors"),
|
||||
`a unexpected error was found: {result}`
|
||||
)
|
||||
end
|
||||
end
|
1
bins/stylua/tests/bad_input.luau
Normal file
1
bins/stylua/tests/bad_input.luau
Normal file
|
@ -0,0 +1 @@
|
|||
local a = 5
|
1
bins/stylua/tests/good_input.luau
Normal file
1
bins/stylua/tests/good_input.luau
Normal file
|
@ -0,0 +1 @@
|
|||
local a = 5
|
22
bins/stylua/tests/run.luau
Normal file
22
bins/stylua/tests/run.luau
Normal file
|
@ -0,0 +1,22 @@
|
|||
local toolchainlib = require("../lune_packages/core")
|
||||
local process = require("@lune/process")
|
||||
|
||||
return function(version)
|
||||
do
|
||||
-- not working, needing support
|
||||
-- process.args = { "--check bins/stylua/tests/bad_input.luau", "--output-format summary" }
|
||||
local success, result = pcall(require, "bins/stylua/init.luau")
|
||||
assert(success, `failed to execute stylua: {result}`)
|
||||
|
||||
assert(string.find(result, "Code style issues found"), `any expected error was found: {result}`)
|
||||
end
|
||||
|
||||
do
|
||||
-- not working, needing support
|
||||
-- process.args = { "--check bins/stylua/tests/good_input.luau", "--output-format summary" }
|
||||
local success, result = pcall(require, "bins/stylua/init.luau")
|
||||
assert(success, `failed to execute stylua: {result}`)
|
||||
|
||||
assert(string.find(result, "All files are correctly formatted."), `a unexpected error was found: {result}`)
|
||||
end
|
||||
end
|
|
@ -3,11 +3,14 @@ local process = require("@lune/process")
|
|||
local fs = require("@lune/fs")
|
||||
|
||||
return function(version)
|
||||
-- not working, needing support
|
||||
-- process.args = { "bins/zap/tests/input.zap" }
|
||||
local success, err = pcall(require, "bins/zap/init.luau")
|
||||
|
||||
assert(success, `failed to execute zap: {err}`)
|
||||
|
||||
assert(fs.isFile("tests/output/client.luau"), `invalid output`)
|
||||
assert(fs.isFile("tests/output/server.luau"), `invalid output`)
|
||||
local client_signature = `\n-- Client generated by Zap v{version} (https://github.com/red-blox/zap)`
|
||||
assert(fs.readFile("bins/zap/tests/output/client.luau"):match(client_signature), `invalid output`)
|
||||
|
||||
local server_signature = `\n-- Server generated by Zap v{version} (https://github.com/red-blox/zap)`
|
||||
assert(fs.readFile("bins/zap/tests/output/server.luau"):match(server_signature), `invalid output`)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue