repo stringclasses 341
values | file_path stringlengths 29 173 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.66M | tokens int64 2 598k |
|---|---|---|---|---|---|
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/globals/runtime.luau | luau | .luau | -- Credit to Bottersnike
local function isProbablyUrl(x: string)
return x:sub(1, 7) == "http://" or x:sub(1, 8) == "https://"
end
local function isProbablyGitUrl(x: string)
if isProbablyUrl(x) then
return true
end
return x:sub(1, 6) == "git://" or x:sub(1, 6) == "ssh://"
end
-- Validation for _RUNTIME
if not _R... | 1,501 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/globals/script.luau | luau | .luau | local fs = require("@std/fs")
local function parent()
assert(
fs.path.child(script:parent()) == "globals",
"parent of this script should be globals"
)
end
parent()
local function projectdir()
local pr = script:project()
assert(
fs.path.child(pr) == "seal",
"lol did you ... | 93 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/interop/mlua.luau | luau | .luau | local mlua = require("@interop/mlua")
local i = 1200
local f = 1200.01
local bignumber = 1231231231234445
assert(mlua.isint(i) == true, "int is int")
assert(mlua.isint(f) == false, "number is false")
assert(mlua.isint(bignumber) == true, "big integer number actually represented as LuaInteger not LuaNumber (mlua 0.10.... | 165 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/ar.luau | luau | .luau | local ar = require("@std/archive/ar")
local archive = require("@std/archive")
local entry = require("@std/archive/entry")
local fs = require("@std/fs")
const file = entry.create.file
const directory = entry.create.directory
const symlink = entry.create.symlink
const temp_path = fs.path.join(script:parent(), "temp_ar"... | 1,006 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/archive.luau | luau | .luau | -- tests the Archive extern type itself: create, append, insert, remove, get, paths, #, serialize
local archive = require("@std/archive")
local entry = require("@std/archive/entry")
const file = entry.create.file
const directory = entry.create.directory
local fs = require("@std/fs")
local format = require("@std/io/fo... | 3,286 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/cross_format.luau | luau | .luau | --[=[
Reading an archive in one format and serializing it to another should preserve its contents
exactly, so this walks a single archive through every container format and back out again.
]=]
local archive = require("@std/archive")
local zip = require("@std/archive/zip")
local tar = require("@std/archive/tar")... | 1,652 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/deb.luau | luau | .luau | local deb = require("@std/archive/deb")
local ar = require("@std/archive/ar")
local tar = require("@std/archive/tar")
local archive = require("@std/archive")
local entry = require("@std/archive/entry")
local fs = require("@std/fs")
const file = entry.create.file
const temp_path = fs.path.join(script:parent(), "temp_d... | 1,224 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/sevenz.luau | luau | .luau | local sevenz = require("@std/archive/sevenz")
local archive = require("@std/archive")
local entry = require("@std/archive/entry")
local fs = require("@std/fs")
const file = entry.create.file
const directory = entry.create.directory
const temp_path = fs.path.join(script:parent(), "temp_sevenz")
fs.dir.ensure(temp_path... | 948 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/tar.luau | luau | .luau | local tar = require("@std/archive/tar")
local archive = require("@std/archive")
local entry = require("@std/archive/entry")
local fs = require("@std/fs")
const file = entry.create.file
const directory = entry.create.directory
const symlink = entry.create.symlink
type ArchiveFormat = archive.ArchiveFormat
const temp_... | 2,345 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/archive/zip.luau | luau | .luau | local zip = require("@std/archive/zip")
local archive = require("@std/archive")
local entry = require("@std/archive/entry")
local env = require("@std/env")
local fs = require("@std/fs")
const file = entry.create.file
const normal_path = "./tests/data/archives/zips/normal.zip"
const temp_path = fs.path.join(script:par... | 2,637 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/args/fakeseal.luau | luau | .luau | local args = require("@std/args")
local err = require("@std/err")
local parsed = args.parse("seal", "the cutest luau runtime", {
description = "A highly reliable scripting and automation-focused Luau runtime",
examples = {
"./myfile.luau" ,
"run",
"setup",
},
footer = "See the r... | 389 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/args/gsw.luau | luau | .luau | local args = require("@std/args")
local parsed = args.parse("gsw", "a simple fuzzy git branch switcher", {
examples = {
"main",
"mybranch --create",
"mybr"
},
footer = "written with seal in luau by deviaze :)"
}):simple(
args.positional("branch", "any part of the branch you want... | 208 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/args/init.luau | luau | .luau | local env = require("@std/env")
local fs = require("@std/fs")
local process = require("@std/process")
local gsw_path = fs.path.join(script:parent(), "gsw.luau")
local lgti_path = fs.path.join(script:parent(), "commands.luau")
local fakeseal_path = fs.path.join(script:parent(), "fakeseal.luau")
local function gsw()
... | 977 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/crypt/aes.luau | luau | .luau | local aes = require("@std/crypt/aes")
local key = aes.generatekey()
local ciphertext = aes.encrypt("meoweharhe", key)
local plaintext = aes.decrypt(ciphertext, key)
assert(plaintext == "meoweharhe", "aes plaintext doesn't match")
| 60 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/crypt/generate_keys.luau | luau | .luau | local crypt = require("@std/crypt")
local aes = crypt.aes
local rsa = crypt.rsa
local AES_KEY = aes.generatekey()
local RSA_KEYS = rsa.generatekeys()
assert(RSA_KEYS.private:match("BEGIN PRIVATE"), "private key not privating")
assert(RSA_KEYS.public:match("BEGIN PUBLIC"), "public key not publicing")
| 75 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/crypt/hash.luau | luau | .luau | local hash = require("@std/crypt/hash")
local test_plaintext = "meow is the goat of course"
local hashed = hash.sha2(test_plaintext)
assert(typeof(hashed) == "buffer", "should be a buffer") | 51 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/crypt/password.luau | luau | .luau | local hex = require("@std/serde/hex")
local password = require("@std/crypt/password")
local raw_test_password = "meowVeryComplexPassword2##@!#$"
local hashed_password: password.HashedPassword = password.hash(raw_test_password)
local hexified_hash = hex.encode(hashed_password.hash)
assert(#hexified_hash == 64, "why is... | 305 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/crypt/rsa.luau | luau | .luau | local fs = require("@std/fs")
local rsa = require("@std/crypt/rsa")
local keys = rsa.generatekeys()
local data_dir = fs.dir.from("./tests/data")
:add_file("public.key", keys.public)
:add_file("private.key", keys.private)
local encrypted = rsa.encrypt("whoami", keys.public)
local decrypted = rsa.decrypt(encrypted, ... | 138 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/env.luau | luau | .luau | local env = require("@std/env")
local _vars = require("@std/env/vars")
local function consts()
assert(env.os ~= nil, "we should have an env.os")
assert(env.arch ~= nil, "we should have an env.arch")
end
consts()
local function iterate_args()
for _, arg in env.args do
print(arg)
end
end
itera... | 431 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/err.luau | luau | .luau | local err = require("@std/err")
local fs = require("@std/fs")
local function withmessage()
local e = err.message("meow")
assert(typeof(e) == "error", "wrapped error should be made of error")
end
withmessage()
local function traceback()
local tracy = err.traceback(nil, 0)
print(tracy)
end
traceback()... | 169 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/copy.luau | luau | .luau | local fs = require("@std/fs")
local copytreepath = "./tests/data/copytree"
if fs.path.exists(copytreepath) then
fs.removetree(copytreepath)
end
local copytree = fs.dir.create("./tests/data/copytree")
copytree
:add_file("regularfile", "regularcontent")
:add_tree("atree", fs.tree()
:with_tree("subdir", fs.tree()
... | 335 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/directory_entry.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local data_path = fs.path.join(".", "tests", "data")
local data_dir = fs.dir.from(data_path)
local function addingandchaining()
local dirents = data_dir:add_tree("dirents", fs.tree()
:with_tree("hi", fs.tree()
:with_file("veryentry.txt", "hi")
:w... | 497 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/dirlib.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local function ensuredir()
local src = fs.dir.ensure("./src")
assert(src.path == "./src", "why not ensure src?")
assert(#src:list() > 0, "oh no we just wiped the whole srcdir??")
local previously_nonexistent_path = fs.path.join(".", "tests", "data", "m... | 630 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/entries.luau | luau | .luau | --!nolint LocalShadow
local fs = require("@std/fs")
for path, entry in fs.entries(".") do
if entry.type == "File" then
assert(typeof(entry.name) == "string", "where entry.name?")
local content = (entry :: fs.FileEntry):read()
assert(typeof(content) == "string", "file content is not string?")
else
for nested_... | 274 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/file_entry.luau | luau | .luau | local fs = require("@std/fs")
local path = fs.path
local datadir = fs.dir.from(path.join(".", "tests", "data"))
local testentrypath = path.join(datadir.path, "testentry.txt")
if path.exists(testentrypath) then
fs.removefile(testentrypath)
end
local function canwriteentry()
local file = fs.file.create(testentrypath... | 357 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/filesize.luau | luau | .luau | -- tests for our custom FileSize extern type userdata
local filesize = require("@std/fs/filesize")
local function lt()
local five_bytes = filesize.bytes(5)
local six_bytes = filesize.bytes(6)
assert(five_bytes < six_bytes, "FileSize < not work")
assert(six_bytes > five_bytes, "FileSize > not work")
en... | 1,434 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/find.luau | luau | .luau | --!nolint LocalShadow
local fs = require("@std/fs")
local mlua = require("@interop/mlua")
local function findfile()
local cargo_toml_result: fs.FindResult = fs.find("./Cargo.toml")
assert(cargo_toml_result.ok == true :: boolean, "Cargo.toml result.ok should be true")
assert(cargo_toml_result.type == "File", "why i... | 862 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/is.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local str = require("@std/str")
local time = require("@std/time")
local process = require("@std/process")
local function is()
local data_path = fs.path.canonicalize(fs.path.join(".", "tests", "data"))
if env.os == "Linux" or env.os == "MacOS" then
... | 549 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/listing.luau | luau | .luau | local fs = require("@std/fs")
local src_path = fs.path.join(".", "src")
local function listbasic()
local src_files = fs.listdir(src_path)
assert(table.find(src_files, fs.path.join(".", "src", "main.rs")), "main.rs should be in there")
assert(table.find(src_files, fs.path.join(".", "src", "std_fs", "find.r... | 228 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/move.luau | luau | .luau | local fs = require("@std/fs")
local datadir = fs.dir.from("./tests/data")
local old_movetrees = datadir:find("movetrees"):try_file()
if old_movetrees then
old_movetrees:remove()
end
datadir:add_tree("movetrees", fs.tree()
:with_tree("start", fs.tree()
:with_file("move1", "moveme")
:with_tree("movefolder", fs.t... | 359 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/pathlib_join.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local function simplepaths()
assert(fs.path.join(".", "src", "main.rs") == "./src/main.rs", "simple paths broke?")
end
simplepaths()
local function slashesgetstripped()
local p = `/{fs.path.join("cats", "/dogs")}/`
local slashed = fs.path.join("./", p)... | 706 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/read/readbytes.luau | luau | .luau | --!nonstrict
--!nolint LocalShadow
local fs = require("@std/fs")
local funny_story = "./tests/data/funny_story.txt"
local function getanewbuffer()
local buffy = fs.readbytes(funny_story)
assert(type(buffy) == "buffer", "where buffy?")
end
getanewbuffer()
local function getnewbuffercount()
local buffy = fs.readby... | 202 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/read/readfile.luau | luau | .luau | --!nolint LocalShadow
local fs = require("@std/fs")
local res = fs.readfile("./tests/data/funny_story.txt")
assert(res:match("Luau"), "fs/read/readfile did we read wrong file?")
-- we can read binary file?
local res = fs.readfile("./tests/data/nanuk.png")
-- make sure we get comparable results w/ fs.readbytes
local b... | 182 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/read/readlines.luau | luau | .luau | local fs = require("@std/fs")
local server_views = fs.dir.from("./tests/data/server-views")
local index_file = server_views:expect_file("index.html")
local read_normally = index_file:read()
local split_lines = read_normally:split("\n")
for line_number, line in index_file:readlines() do
if line_number == 1 then
as... | 225 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/remove.luau | luau | .luau | local fs = require("@std/fs")
local data_dir = fs.dir.from("./tests/data")
local function basicremovefile()
data_dir:add_file("removeme", "oops")
fs.removefile(fs.path.join(data_dir.path, "removeme"))
local s, f = pcall(function()
fs.removefile("startsfeiontnesart.rstas")
return nil
end)
assert(s == fa... | 338 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/symlinks.luau | luau | .luau | local env = require("@std/env")
local fs = require("@std/fs")
local try = require("@tests/try")
local symlink_path = fs.path.join(".", "tests", "data", "some_symlink")
local target = fs.path.canonicalize("./.vscode/settings.json")
local function creatingsymlinks()
if env.os == "Linux" or env.os == "MacOS" then
... | 343 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/trees.luau | luau | .luau | --!strict
local fs = require("@std/fs")
local datadir = "./tests/data"
local writetreesdir = fs.path.join(datadir, "writetrees")
if fs.dir(writetreesdir) then
fs.removetree(writetreesdir)
end
fs.writetree(writetreesdir, fs.tree()
:with_file("name", "content")
:with_file("main.luau", 'return "hi"')
:... | 427 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/watch/child.luau | luau | .luau | local fs = require("@std/fs")
local time = require("@std/time")
local tp = fs.path.join(script:parent(), "testfile.txt")
if channel then
fs.file.try_remove(tp) -- Remove::File
time.wait(1)
fs.writefile(tp, "content") -- Modify::Data & Close
time.wait(1)
local c = fs.readfile(tp) -- apparently nothin... | 239 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/fs/watch/watch.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local thread = require("@std/thread")
local format = require("@std/io/format")
local cheese = require("@tests/cheese")
local function watchiter()
-- child thread calls fs lib fns to simulate 'reproducible' fs events
local handle = thread.spawn {
... | 929 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/colors.luau | luau | .luau | local colors = require("@std/io/colors")
local format = require("@std/io/format")
local function assert_contains(s: string, substr: string, label: string)
if not string.find(s, substr, 1, true) then
error(`FAIL [{label}]: expected {format.debug(s)} to contain {format.debug(substr)}`)
end
print(colo... | 987 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/events.luau | luau | .luau | local time = require("@std/time")
local terminal = require("@std/terminal")
local output = require("@std/io/output")
terminal.rawmode.enable()
for event in terminal.events(time.milliseconds(20)) do
if event.type == "Key" then
if event.key == "c" and event.modifiers.ctrl then
print("\r\n")
... | 229 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/format.luau | luau | .luau | local env = require("@std/env")
local colors = require("@std/io/colors")
local format = require("@std/io/format")
local function meow() end
print({
meow,
cats = 2,
})
local t = setmetatable({
x = 1,
y = 2,
}, {
__call = function(self: any, hmm: string): string
return hmm .. "call"
end
... | 389 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/init.luau | luau | .luau | --!nolint DeprecatedApi
local io = require("@std/io")
print(io.colors.red("meow"))
print(io.input.get("whoami: ")) | 33 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/output.luau | luau | .luau | local output = require("@std/io/output")
local thing = {
a = 2,
b = 3,
c = function(a: string) end,
d = {
s = 1,
b = 2
}
}
print("meow")
output.clear()
print("hi")
output.write("hi")
output.ewrite("bye")
output.write("stasrtfwa")
output.clear()
p("hi") | 90 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/prompts/errors.luau | luau | .luau | local prompt = require("@std/io/prompt")
local try = require("@tests/try")
local result = try(function()
return prompt.pick("hi", { hi = 2 })
end):throws("options table is empty or")
| 50 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/prompts/prompt_password.luau | luau | .luau | local prompt = require("@std/io/prompt")
local pass = prompt.password("ssh key?")
print(pass)
local passask = prompt.password("number of children", "*")
print(passask) | 39 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/raw.luau | luau | .luau | local terminal = require("@std/terminal")
local time = require("@std/time")
local contents = ""
if terminal.tty() then
terminal.rawmode.enable()
terminal.capture.paste(true)
for event in terminal.events(time.milliseconds(100)) do
if event.type == "Empty" then
continue
end
... | 161 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/read.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local process = require("@std/process")
local time = require("@std/time")
local cheese = require("@tests/cheese")
local CACHE_DIR = fs.path.join(fs.path.home(), ".cache")
fs.dir.ensure(CACHE_DIR)
local written_scripts: { string } = {}
-- writes `src` to a... | 2,016 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/io/readline.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local process = require("@std/process")
local time = require("@std/time")
local cheese = require("@tests/cheese")
local function runsealwithprompt(prompt: string)
local src = string.gsub([[
local input = require("@std/io/input")
local result = i... | 423 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/json.luau | luau | .luau | --!strict
local json = require("@std/json")
local str = require("@std/str")
local function unindent(s: string): string
return str.unindent(s, "Spaces", 4)
end
local function unencodable()
local bad = {
c = 5,
d = {
f = function() return "hi" end,
}
}
local s, result... | 732 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/luau/eval.luau | luau | .luau | local luau = require("@std/luau")
local function returnstable()
local src = [[
return {
seal_version = "0.0.6-rc.1"
}
]]
local content = luau.eval(src)
assert(typeof(content) ~= "error", "seal_version table shouldn't be error, should've worked")
assert(typeof(content) == "table", "s... | 1,058 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/net/http/get.luau | luau | .luau | --!strict
--!nolint LocalShadow
local http = require("@std/net/http")
local time = require("@std/time")
local todo1 = http.get {
url = "https://jsonplaceholder.typicode.com/todos/1",
timeout = {
send_request = time.seconds(2),
}
}
local postsuserid1 = http.get({
url = "https://jsonplaceholder.... | 256 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/exit.luau | luau | .luau | -- requiring a file that calls process.exit should not panic (Lune's behavior)
local fs = require("@std/fs")
local env = require("@std/env")
local process = require("@std/process")
local test_dir = fs.dir.from(script:parent())
local file_immediately_exits_src = [[
local process = require("@std/process")
process.ex... | 649 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/init.luau | luau | .luau | -- local process = require("@std/process")
-- local child = process.spawn {
-- program = "seal",
-- args = { "--help" }
-- } | 35 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/run.luau | luau | .luau | local process = require("@std/process")
local env = require("@std/env")
local seal_path = env.executable_path
if env.os ~= "Windows" then
local res = process.run {
program = "cd ./src; pwd",
shell = "sh",
}
assert(res.ok == true, `result failed: {res.stderr}`)
end
local function nonexistentprogram()
local s,... | 521 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/shell.luau | luau | .luau | local env = require("@std/env")
local process = require("@std/process")
if env.os == "Linux" or env.os == "Android" then
local result = process.shell("ls -l")
:unwrap()
:split("\n")
assert(result[1]:match("total ([%d]+)"), "first ls -l result doesnt match")
end
if env.os == "Windows" then
local res2 = process.... | 133 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/capacities.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local filesize = require("@std/fs/filesize")
local process = require("@std/process")
local time = require("@std/time")
local str = require("@std/str")
local cheese = require("@tests/cheese")
local function spawn_poem(stdout_capacity: FileSize, stderr_capaci... | 729 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/ception.luau | luau | .luau | local time = require("@std/time")
print("first")
time.wait(0.75)
print("o_o")
time.wait(0.5)
for _, saying in { "cats", "dogs", "seals" } do
print(`got {saying}`)
time.wait(0.45)
end
| 67 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/ception_watcher.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local process = require("@std/process")
local cheese = require("@tests/cheese")
local function watchception()
local ception_path = fs.path.join(script:parent(), "ception.luau")
local child = process.spawn {
program = env.executable_path... | 415 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/has_stdin.luau | luau | .luau | local input = require("@std/io/input")
print("welcome")
local result = input.readline("say 'yes' to continue: ")
print(`input received: {result}`) | 36 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/inherit.luau | luau | .luau | local env = require("@std/env")
local fs = require("@std/fs")
local process = require("@std/process")
local path = fs.path.join(script:parent(), "inheriting", "runme.luau")
local result = process.run {
program = `{env.executable_path} {path}`,
shell = true
}
assert(result.ok and result.out == "meow", `inherit... | 227 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/inheriting/child.luau | luau | .luau | local env = require("@std/env")
print(env.vars.get("PROD"))
print(env.vars.get("SHELL")) | 24 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/inheriting/runme.luau | luau | .luau | local env = require("@std/env")
local process = require("@std/process")
if env.os == "Windows" then
local child = process.run {
program = env.executable_path,
args = { "eval", [[print("meow")]] },
stdio = "Inherit",
}
else
local child = process.run {
program = [[./target/rel... | 108 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/long_waiter.luau | luau | .luau | local time = require("@std/time")
print("hehe")
time.wait(2)
print("meow") | 23 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/longrunning.luau | luau | .luau | -- example of a long running process that doesnt instantly terminate
local time = require("@std/time")
local args = require("@std/env").args
print("Starting...")
while time.wait(0.125) do
local x = math.random(1, tonumber(args[1]) or 125)
print(x)
if x > (tonumber(args[2]) or 115) then
break
end
end
print("Sto... | 92 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/nonblocking.luau | luau | .luau | local env = require("@std/env")
local process = require("@std/process")
local folder_path = "./tests/luau/std/process/spawn/"
local longrunning_path = `{folder_path}/longrunning.luau`
local seal_path = env.executable_path
local function test_reads()
local child = process.spawn {
program = seal_path,
args = { lo... | 322 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/read.luau | luau | .luau | --!nolint LocalShadow
local fs = require("@std/fs")
local env = require("@std/env")
local str = require("@std/str")
local time = require("@std/time")
local path = require("@std/fs/path")
local process = require("@std/process")
local cheese = require("@tests/cheese")
local function spawn_long_waiter(): process.ChildPr... | 1,362 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/read_to.luau | luau | .luau | local process = require("@std/process")
local env = require("@std/env")
local path = require("@std/fs/path")
local str = require("@std/str")
local time = require("@std/time")
local cheese = require("@tests/cheese")
-- Timing assertions need slack: debug builds spawn and initialize child processes noticeably
-- slower... | 1,153 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/stdin_write.luau | luau | .luau | local fs = require("@std/fs")
local env = require("@std/env")
local process = require("@std/process")
local time = require("@std/time")
local cheese = require("@tests/cheese")
local CACHE_DIR = fs.path.join(fs.path.home(), ".cache")
fs.dir.ensure(CACHE_DIR)
local written_scripts: { string } = {}
local function make_c... | 697 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/process/spawn/streaming_buffers.luau | luau | .luau | local process = require("@std/process")
local env = require("@std/env")
local fs = require("@std/fs")
local str = require("@std/str")
local cheese = require("@tests/cheese")
local seal_path = env.executable_path
local longrunning_path = fs.path.join(script:parent(), "longrunning.luau")
local function spawn_longrunnin... | 1,374 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/semver.luau | luau | .luau | local semver = require("@std/semver")
local function lessthan()
local s1 = semver.from("0.0.1")
local s2 = semver.from("0.0.2")
assert(s2 > s1, "semver s2 should be greater than s1")
end
lessthan()
local function rclessthan()
local sbase = semver.from("0.0.2")
local s1 = semver.from("0.0.2-rc.1")... | 618 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/base64.luau | luau | .luau | local fs = require("@std/fs")
local base64 = require("@std/serde/base64")
local nanuk_buffy = fs.readbytes("./tests/data/nanuk.png")
local sensible_nanuk = base64.encode(nanuk_buffy)
local function standardserdeworks()
local nanuk_encoded_64 = base64.encode(fs.readbytes("./tests/data/nanuk.png"))
local nanuk_decode... | 243 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/hex.luau | luau | .luau | local hex = require("@std/serde/hex")
local random_buffy = buffer.create(4)
local original_number = 2131
buffer.writef32(random_buffy, 0, original_number)
local data = hex.encode(random_buffy)
assert(#data == 8, "f32 should be encoded to a string 8 characters long")
local decoded = hex.decode(data)
local decoded_num... | 107 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/lz4.luau | luau | .luau | local lz4 = require("@std/serde/lz4")
local result = lz4.compress("we are the dead short days ago we lived felt dawn and saw the sunset glow")
local dec = lz4.decompress(result, 100)
assert(buffer.tostring(dec) == "we are the dead short days ago we lived felt dawn and saw the sunset glow") | 74 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/toml.luau | luau | .luau | local toml = require("@std/serde/toml")
local str = require("@std/str")
local function readfile()
local stuff = toml.readfile("./Cargo.toml")
assert(stuff.dependencies.toml ~= nil, "Cargo.toml doesn't have toml as dependency? (can't read toml?)")
end
readfile()
local function basicserde()
local cats = {
Taz = {... | 218 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/url.luau | luau | .luau | local url = require("@std/serde/url")
local encoded = url.encode("seal is cool lol")
assert(encoded == "seal%20is%20cool%20lol", `encoded should be seal%20is%20cool%20lol, got {encoded}`)
local decoded = url.decode(encoded)
assert(decoded == "seal is cool lol", `decoded should be seal is good lol got: {decoded}`)
lo... | 187 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/yaml.luau | luau | .luau | local yaml = require("@std/serde/yaml")
local path = require("@std/fs/path")
local null = require("@std/json").null()
local content = {
why = 1,
am = 2,
i_like = 3,
this = {1, 2, 3, 4, "hi"},
are = {
you = {
too = 1
}
}
}
local example_yaml_path = path.join(".", "tests", "data", "example_yaml.yaml")
loc... | 254 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/zlib.luau | luau | .luau | local zlib = require("@std/serde/zlib")
local bytes = buffer.create(16)
buffer.writestring(bytes, 0, "hello there")
local compressed = zlib.compress(bytes, "Default")
local buffy = zlib.decompress(compressed)
assert(buffer.tostring(buffy) == "hello there\0\0\0\0\0") | 73 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/serde/zstd.luau | luau | .luau | local fs = require("@std/fs")
local zstd = require("@std/serde/zstd")
local mainrs = fs.readbytes("./src/main.rs")
local compressed = zstd.compress(mainrs)
assert(
buffer.tostring(zstd.decompress(compressed)) == buffer.tostring(mainrs),
"buffers don't match"
)
| 69 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/terminal/options.luau | luau | .luau | local process = require("@std/process")
local terminal = require("@std/terminal")
local cursor = require("@std/terminal/cursor")
local time = require("@std/time")
local animals = { "seal", "monkey", "rhino", "dolphin", "crab", "gopher" }
local function draw(selected: number, start_row: number)
local actions = { c... | 487 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/terminal/spinner.luau | luau | .luau | local terminal = require("@std/terminal")
local cursor = require("@std/terminal/cursor")
local time = require("@std/time")
local keyframes = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
local function spinner(message: string, duration_seconds: number)
local pos = cursor.position()
-- Hide cursor duri... | 274 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/terminal/tui.luau | luau | .luau | local process = require("@std/process")
local str = require("@std/str")
local terminal = require("@std/terminal")
local cursor = require("@std/terminal/cursor")
local time = require("@std/time")
if terminal.tty() then
if not terminal.rawmode.enabled() then
terminal.rawmode.enable()
end
terminal.ex... | 579 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/cant-send-functions/child.luau | luau | .luau | local time = require("@std/time")
if channel then
local message: { stuff : string }? = nil
while time.wait(0.1) do
message = channel:read()
if message ~= nil then
break
end
end
if message ~= nil then
channel:send(message.stuff .. " ok")
end
time.wait(0.25)
local new_data = channel:read()
if new_data... | 104 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/cant-send-functions/parent.luau | luau | .luau | --!nonstrict
--!nolint LocalShadow
local thread = require("@std/thread")
local time = require("@std/time")
local child_handle = thread.spawn({
path = "./child.luau",
})
child_handle:send({
stuff = "aa"
})
time.wait(0.125)
print(child_handle:read())
local s, err = pcall(function()
child_handle:send(function() en... | 219 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/conc_1.luau | luau | .luau | -- this should be a subscript/thread
local time = require("@std/time")
local reps = 0
local success, err = pcall(function()
while true do
time.wait(0.25)
reps += 1
print("heh")
if reps > 24 then
break
elseif reps == 18 then
error("how break traceback?")
end
end
return nil
end)
assert(success == ... | 107 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/get-threads/parent.luau | luau | .luau | --!nonstrict
--!nolint LocalShadow
local thread = require("@std/thread")
local format = require("@std/io/format")
local urls: {string} = {
"https://meow.com",
"https://google.com",
"https://en.wikipedia.org/wiki/Cat",
"https://catfact.ninja/fact",
"https://jsonplaceholder.typicode.com/todos/1",
}
-- get in paral... | 366 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/get-threads/send_request.luau | luau | .luau | local http = require("@std/net/http")
if channel and channel.data then
local content = channel.data :: { url: string }
local result = http.get {
url = content.url
}
if result.ok then
if result.body:match("^{") then
channel:send(result:expect_json())
else
channel:send(result.body)
end
end
elseif not ... | 98 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/init.luau | luau | .luau | --!nonstrict
local thread = require("@std/thread")
local time = require("@std/time")
assert(thread.parallelism() > 0, "where is thread.parallelism?")
local handle = thread.spawn({
path = "./conc_1.luau"
})
print("first")
local t = 0
repeat
time.wait(0.25)
t += 1
print("hm")
until t == 20
handle:join()
print("t... | 96 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/message-passing/child_thread.luau | luau | .luau | local time = require("@std/time")
if channel then
print("we in thread bois")
while time.wait(1) do
local data = channel:read()
if data then
local d = data :: {
t: number,
content: string,
}
if d.content == "break" then
break
end
channel:send {
t = d.t,
content = d.content:gs... | 110 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/read-await/child_await.luau | luau | .luau | --!nonstrict
local time = require("@std/time")
if channel then
local data = channel.data :: any
print(`CHILD: recv: {table.concat(data.some.nested)}`)
time.wait(1.25)
channel:send({
message = "I daresay data is cool too"
})
local buffy = channel:readbytes_await()
local recv = buffer.readstring(buffy, 0, 5)
a... | 112 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/thread/spawning_threads.luau | luau | .luau | --!nonstrict
local thread = require("@std/thread")
local time = require("@std/time")
local handle = thread.spawn({
src = [[
if channel then
local time = require("@std/time")
local datetime = time.datetime
time.wait(1)
local result = channel:read()
print(result)
local rn = datetime.now():format(dat... | 213 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/time/duration.luau | luau | .luau | local time = require("@std/time")
local function daymath()
local days = time.days(10) - time.days(40)
assert(days.days == -30, "we should be -30 days now")
end
daymath()
local function minusing()
local d = time.days(10) - time.seconds(200)
assert(d.seconds == 863800, "should be 863800 seconds here")
... | 446 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/luau/std/time/wait.luau | luau | .luau | local time = require("@std/time")
local function timewaits()
local t0 = os.clock()
time.wait(1)
assert(1 - (os.clock() - t0) < 0.001, "we should have 1 ms precision")
end
local function timewaitsduration()
local t0 = os.clock()
time.wait(time.milliseconds(15))
local since = time.seconds(os.clo... | 126 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/run.luau | luau | .luau | local fs = require("@std/fs")
local io = require("@std/io")
local str = require("@std/str")
local env = require("@std/env")
local colors = require("@std/colors")
local process = require("@std/process")
local tt = require("@extra/tt")
type FailedTest = {
path: string,
err: string,
}
type IgnoredFunctionByName... | 1,925 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/rust/calling.luau | luau | .luau | local fs = require("@std/fs")
local extern = require("@interop/extern")
local env = require("@std/env")
local process = require("@std/process")
local time = require("@std/time")
if env.os == "Linux" then
print("Building extern_example.so")
process.run {
program = "cargo",
args = { "b", "-p", "e... | 574 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/scripts/seal_setup_test.luau | luau | .luau | -- we need to make sure running `seal setup` actually works
-- and that requires in a new project outside seal's repository continue
-- to work properly
local fs = require("@std/fs")
local env = require("@std/env")
local json = require("@std/json")
local process = require("@std/process")
local format = require("@std/i... | 1,463 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/scripts/thirty_two_bit_support.luau | luau | .luau | -- this tests asserts we didn't forget to convert any LuaInteger(i) => i cases to LuaInteger(i) => int_to_i64(i)
const fs = require("@std/fs")
const str = require("@std/str")
const rust_files = fs.listdir("./src", true, function(path)
return str.endswith(path, ".rs")
end)
type OffendingLine = {
file: string,... | 408 |
seal-runtime/seal | seal-runtime-seal-e337169/tests/try.luau | luau | .luau | local function try<T>(f: (() -> T))
local success, result = pcall(f)
if success then
print(`success: got {result}`)
end
local function get(s: boolean, v: T)
return {
s = s,
v = v
}
end
return {
expect = function<T>(self: any, val: T, fail: ... | 286 |
Roblox/cryo | Roblox-cryo-1514eab/src/Dictionary/equals.lua | luau | .lua | local equalObjects = require(script.Parent.Parent.equalObjects)
local function compare(a, b)
if type(a) ~= "table" or type(b) ~= "table" then
return a == b
end
for key, value in a do
if b[key] ~= value then
return false
end
end
for key, value in b do
if a[key] ~= value then
return false
end
end... | 193 |
Roblox/cryo | Roblox-cryo-1514eab/src/Dictionary/filter.lua | luau | .lua | --!strict
--[=[
Returns a Dictionary of only entries for which the `predicate` function returns true.
]=]
local function filter<K, V>(dictionary: { [K]: V }, predicate: ((V, K) -> boolean)): { [K]: V }
local new = {}
for k, v in dictionary do
if predicate(v, k) then
new[k] = v
end
end
return new
end
ret... | 96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.