repo stringclasses 350
values | file_path stringlengths 29 200 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.01M | tokens int64 2 598k |
|---|---|---|---|---|---|
seal-runtime/seal | seal-runtime-seal-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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,385 |
seal-runtime/seal | seal-runtime-seal-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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/dash | Roblox-dash-ae354f0/benchmark/benchmark.lua | luau | .lua | local Packages = game:GetService("ReplicatedStorage").Packages
local JestGlobals = require(Packages.Dev.JestGlobals)
local JestBenchmark = require(Packages.Dev.JestBenchmark)
local describe = JestGlobals.describe
local benchmark = JestBenchmark.benchmark
return function<T>(name: string, times: number, benchFunction: (... | 227 |
Roblox/dash | Roblox-dash-ae354f0/benchmark/join.bench.lua | luau | .lua | local Packages = game:GetService("ReplicatedStorage").Packages
local Dash = require(Packages.Dash)
local Cryo = require(Packages.Dev.Cryo)
local benchmark = require(script.Parent.benchmark)
local DICT_A = {
a = 5,
b = 10,
cherry = 800,
}
local DICT_B = {
apple = 50,
cherry = 80,
fig = 100,
}
local DICT_C = {
ba... | 399 |
Roblox/dash | Roblox-dash-ae354f0/benchmark/union.bench.lua | luau | .lua | local Packages = game:GetService("ReplicatedStorage").Packages
local Dash = require(Packages.Dash)
local Cryo = require(Packages.Dev.Cryo)
local benchmark = require(script.Parent.benchmark)
local DICT_A = {
a = 5,
b = 10,
cherry = 800,
}
local DICT_B = {
apple = 50,
cherry = 80,
fig = 100,
}
local BENCHMARK_ITE... | 154 |
Roblox/dash | Roblox-dash-ae354f0/suites/jest-bench.config.lua | luau | .lua | return {
displayName = "Dash",
testMatch = {
"**/benchmark/*.bench",
},
}
| 24 |
Roblox/dash | Roblox-dash-ae354f0/suites/jest-test.config.lua | luau | .lua | return {
displayName = "Dash",
testMatch = {
"**/tests/*.spec",
},
}
| 24 |
Roblox/dash | Roblox-dash-ae354f0/suites/run-tests.lua | luau | .lua | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local processServiceExists, ProcessService = pcall(function()
return game:GetService("ProcessService")
end)
local Packages = ReplicatedStorage:FindFirstChild("Packages")
if not Packages or not Packages:FindFirstChild("Dev") then
game:GetService("TestServ... | 234 |
Roblox/dash | Roblox-dash-ae354f0/tests/customMatchers.lua | luau | .lua | -- Checks that toString represenation of the error includes given message
local function toThrowWithMessage(_, received, errorMessage)
local ok, error = pcall(received)
local pass = not ok and string.find(error:toString(), errorMessage) ~= nil
local message
if pass then
message = function()
return `expected {e... | 130 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/.lune/.typedefs/fs.luau | luau | .luau | --#selene: allow(unused_variable)
export type MetadataKind = "file" | "dir" | "symlink"
--[=[
@interface MetadataPermissions
@within FS
Permissions for the given file or directory.
This is a dictionary that will contain the following values:
* `readOnly` - If the target path is read-only or not
]=]
export typ... | 1,777 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/.lune/test.luau | luau | .luau | --!strict
--#selene: allow(incorrect_standard_library_use)
-- This is kind of a nightmare, but it gives intellisense without
-- having to disable type checking.
type Fs = typeof(require(".lune/.typedefs/fs"))
type Process = typeof(require(".lune/.typedefs/process"))
local fs = (require :: any)("@lune/fs") :: Fs
local... | 472 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/blake2b/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
--- The front half of the initial values used for the hasher state.
local IV_FRONT = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }
--- The back half of the initial values used for the hasher state.
local IV_BACK = { 0xf3bcc908, 0x84... | 9,500 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/blake2s/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
--- The initial values used for the hasher state.
local IV = { 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 }
--- A list of offsets to use for each round in the compression algorithm.
local SIGMA = {
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... | 3,317 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/md5/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
--- Precomputed MD5 constants. You may compute these manually
--- with `floor(2^32 * abs(sin(i + 1)))` from 0 to 63.
--stylua: ignore
local K = {
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
0x698098d8, 0x8b44f7af, 0xffff5... | 2,072 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/sha1/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
--- An allocation that is reused for blocks during hashing
local BLOCK = table.create(80)
--[=[
Processes `message` from byte `start` to byte `finish` using `digest`.
It is assumed that `(finish - start) % 64 == 0`.
]=]
local function processBlocks(digest: { number }, message: stri... | 1,483 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/sha224/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
--stylua: ignore
local K = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2d... | 2,073 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/sha256/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
--stylua: ignore
local K = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2d... | 2,081 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/sha384/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
local BLOCK_FRONT = table.create(80)
local BLOCK_BACK = table.create(80)
--stylua: ignore
local K_FRONT = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
0x243185be, 0x550c7dc3, 0x72be5d74, 0x80de... | 5,398 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/sha512/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
local BLOCK_FRONT = table.create(80)
local BLOCK_BACK = table.create(80)
--stylua: ignore
local K_FRONT = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
0x243185be, 0x550c7dc3, 0x72be5d74, 0x80de... | 5,444 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/modules/xxhash32/init.luau | luau | .luau | --!strict
--!native
--!optimize 2
local PRIME_1 = 0x9e3779B1
local PRIME_2 = 0x85ebca77
local PRIME_3 = 0xc2B2ae3d
local PRIME_4 = 0x27d4eb2f
local PRIME_5 = 0x165667b1
--[=[
Calculates `a * b` mod 32
]=]
local function mult(a: number, b: number): number
local ah, al = bit32.rshift(a, 16), a % 2 ^ 16
local bh, ... | 1,139 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/blake2b.luau | luau | .luau | local blake2b = require("../modules/blake2b")
local t = os.clock()
local startgc = gcinfo()
assert(
blake2b("abc", 64)
== "ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923",
"(BLAKE2b) abc hash does not match"
)
--stylua: ignore sta... | 5,440 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/blake2s.luau | luau | .luau | local blake2s = require("../modules/blake2s")
local t = os.clock()
local startgc = gcinfo()
assert(
blake2s("abc", 32) == "508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982",
"(BLAKE2s) abc hash does not match"
)
assert(
blake2s("abc", 32, "508c5e8c327c14e2e1a72ba34eeb452f")
== "1e3ed5414ca157217c... | 2,654 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/md5.luau | luau | .luau | local md5 = require("../modules/md5")
local t = os.clock()
local startgc = gcinfo()
local hash, digest = md5("abc")
assert(hash == "900150983cd24fb0d6963f7d28e17f72", "(MD5) abc hash does not match")
assert(digest[1] == 0x90015098, "(MD5) first word of abc hash was incorrect")
assert(digest[2] == 0x3cd24fb0, "(MD5) s... | 997 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/sha1.luau | luau | .luau | local sha1 = require("../modules/sha1")
local t = os.clock()
local startgc = gcinfo()
local hash, digest = sha1("abc")
assert(hash == "a9993e364706816aba3e25717850c26c9cd0d89d", "(SHA-1) abc hash does not match")
assert(digest[1] == 0xa9993e36, "(SHA-1) first word of abc hash was incorrect")
assert(digest[2] == 0x470... | 1,120 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/sha224.luau | luau | .luau | local sha224 = require("../modules/sha224")
local t = os.clock()
local startgc = gcinfo()
local hash, digest = sha224("abc")
assert(hash == "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "(SHA-224) abc hash does not match")
assert(digest[1] == 0x23097d22, "(SHA-224) first word of abc hash was incorrect")... | 1,303 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/sha256.luau | luau | .luau | local sha256 = require("../modules/sha256")
local t = os.clock()
local startgc = gcinfo()
local hash, digest = sha256("abc")
assert(hash == "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "(SHA-256) abc hash does not match")
assert(digest[1] == 0xba7816bf, "(SHA-256) first word of abc hash was inc... | 1,376 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/sha384.luau | luau | .luau | local sha384 = require("../modules/sha384")
local t = os.clock()
local startgc = gcinfo()
local hash, digest = sha384("abc")
assert(
hash == "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7",
"(SHA-384) abc hash does not match"
)
assert(digest[1] == 0xcb00753f, "(SHA... | 1,890 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/sha512.luau | luau | .luau | local sha512 = require("../modules/sha512")
local t = os.clock()
local startgc = gcinfo()
local hash, digest = sha512("abc")
assert(
hash
== "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
"(SHA-512) abc hash does not match"
)
ass... | 2,172 |
Dekkonot/luau-hashing | Dekkonot-luau-hashing-81061a4/tests/xxhash32.luau | luau | .luau | local xxhash32 = require("../modules/xxhash32")
local t = os.clock()
local startgc = gcinfo()
assert(xxhash32("abc") == 0x32d153ff, "(XXH32) abc hash does not match")
-- 852579327
assert(xxhash32("abc", 0x32d153ff) == 0x9041e0d8, "(XXH32) abc hash with seed does not match")
assert(xxhash32("") == 0x02cc5d05, "(XXH32... | 1,057 |
TenebrisNoctua/ClassPP | TenebrisNoctua-ClassPP-3fd1d3b/src/Log/Logger.luau | luau | .luau | --!strict
--[[
Written by @TenebrisNoctua.
Handles logging messages to the output with different methods.
--]]
--// Variables
const MessageConstructor = require('./MessageConstructor')
const Messages = require('./Messages')
--// Local Functions
-- Errors and halts execution of the current thread.
local function ... | 308 |
TenebrisNoctua/ClassPP | TenebrisNoctua-ClassPP-3fd1d3b/src/Log/Messages.luau | luau | .luau | --!strict
--[[
Written by @TenebrisNoctua.
Stores templates for logging messages.
--]]
return table.freeze({
attemptToCreateObjectFromAbstractClass = "Cannot create an object from an abstracted class.",
attemptToExtendAFinalClass = "Cannot create an inherited class from a final class.",
cannotCallFunctionError =... | 773 |
TenebrisNoctua/ClassPP | TenebrisNoctua-ClassPP-3fd1d3b/src/Utility.luau | luau | .luau | --!native
--!strict
--[[
Written by @TenebrisNoctua.
Utilities for Class++.
--]]
--// Variables
const Type = require('./Type')
const type = Type.type
const typeof = Type.typeof
--// Types
type internalClass = Type.internalClass
type objectData = Type.objectData
type defaultClassData = Type.defaultClassData
--... | 1,103 |
TenebrisNoctua/ClassPP | TenebrisNoctua-ClassPP-3fd1d3b/src/init.luau | luau | .luau | --!native
--!strict
--[[
Written by @TenebrisNoctua.
The main module of Class++.
--]]
--[[
WARNING: Unless you know exactly what you're doing, it is not recommended to modify the source code below.
If you ever encounter a bug due to a modification that you have made (which is very likely to happen), DO ... | 6,933 |
sircfenner/png-luau | sircfenner-png-luau-d9f8f3b/src/Types.luau | luau | .luau | export type PNG = {
width: number,
height: number,
pixels: buffer,
readPixel: (x: number, y: number) -> (number, number, number, number),
}
export type Chunk = {
type: string,
offset: number,
length: number,
}
export type IHDRChunk = {
width: number,
height: number,
bitDepth: number,
colorType: number,
in... | 159 |
sircfenner/png-luau | sircfenner-png-luau-d9f8f3b/src/chunks/IHDR.luau | luau | .luau | local Types = require("../Types")
local COLOR_TYPE_BIT_DEPTH = {
[0] = { 1, 2, 4, 8, 16 },
[2] = { 8, 16 },
[3] = { 1, 2, 4, 8 },
[4] = { 8, 16 },
[6] = { 8, 16 },
}
local function read(buf: buffer, chunk: Types.Chunk): Types.IHDRChunk
assert(chunk.length == 13, "IHDR data must be 13 bytes")
local offset = ch... | 398 |
sircfenner/png-luau | sircfenner-png-luau-d9f8f3b/src/chunks/PLTE.luau | luau | .luau | local Types = require("../Types")
local function read(buf: buffer, chunk: Types.Chunk, header: Types.IHDRChunk): Types.PLTEChunk
assert(chunk.length % 3 == 0, "malformed PLTE chunk")
local count = chunk.length / 3
assert(count > 0, "no entries in PLTE")
assert(count <= 256, "too many entries in PLTE")
assert(cou... | 206 |
sircfenner/png-luau | sircfenner-png-luau-d9f8f3b/src/chunks/init.luau | luau | .luau | return {
IHDR = require("@self/IHDR"),
PLTE = require("@self/PLTE"),
tRNS = require("@self/tRNS"),
}
| 34 |
sircfenner/png-luau | sircfenner-png-luau-d9f8f3b/src/chunks/tRNS.luau | luau | .luau | local Types = require("../Types")
local function readU16(buf: buffer, offset: number, depth: number)
return bit32.extract(
bit32.bor(bit32.lshift(buffer.readu8(buf, offset), 8), buffer.readu8(buf, offset + 1)),
0,
depth
)
end
local function read(
buf: buffer,
chunk: Types.Chunk,
header: Types.IHDRChunk,
p... | 379 |
sircfenner/png-luau | sircfenner-png-luau-d9f8f3b/src/crc32.luau | luau | .luau | --!native
--!optimize 2
-- stylua: ignore
local lookup = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DD... | 2,337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.