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
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/query.test.luau
luau
.luau
local syntax = require("@std/syntax") local query = require("@std/syntax/query") local test = require("@std/test") local utils = require("@std/syntax/utils") test.suite("CstQuery", function(suite) suite:case("filter", function(assert) local testQuery = query.findAllFromRoot(syntax.parse("local _ = {0, 1, 2, 3, 4}")...
5,992
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/mixedReplacements.snap.luau
luau
.luau
local query = require("@std/syntax/query") local syntaxTypes = require("@std/syntax/types") local syntaxUtils = require("@std/syntax/utils") local util = require("./util") util.printReplacement("mixedReplacements", function(cst) local replacements: syntaxTypes.Replacements = {} local bools = query.findAllFromRoot(cs...
146
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/structuredReplacementDefaultPreservesTrivia.snap.luau
luau
.luau
local query = require("@std/syntax/query") local syntaxUtils = require("@std/syntax/utils") local util = require("./util") util.printReplacement("structuredReplacementDefaultPreservesTrivia", function(cst) return query.findAllFromRoot(cst, syntaxUtils.isExprConstantBool):replace(function(_) return { content = "repl...
76
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/structuredReplacementPreservesTrivia.snap.luau
luau
.luau
local query = require("@std/syntax/query") local syntaxUtils = require("@std/syntax/utils") local util = require("./util") util.printReplacement("structuredReplacementPreservesTrivia", function(cst) return query.findAllFromRoot(cst, syntaxUtils.isExprConstantBool):replace(function(_) return { content = "replaced", ...
79
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/structuredReplacementStripsStatTrivia.snap.luau
luau
.luau
local query = require("@std/syntax/query") local syntaxUtils = require("@std/syntax/utils") local util = require("./util") util.printReplacement("structuredReplacementStripsStatTrivia", function(cst) return query.findAllFromRoot(cst, syntaxUtils.isStatLocal):replace(function(_) return syntaxUtils.replacementWithout...
80
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/structuredReplacementStripsTrivia.snap.luau
luau
.luau
local query = require("@std/syntax/query") local syntaxUtils = require("@std/syntax/utils") local util = require("./util") util.printReplacement("structuredReplacementStripsTrivia", function(cst) return query.findAllFromRoot(cst, syntaxUtils.isExprConstantBool):replace(function(_) return { content = "replaced", pre...
79
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/structuredReplacementStripsTypeTrivia.snap.luau
luau
.luau
local query = require("@std/syntax/query") local syntaxUtils = require("@std/syntax/utils") local util = require("./util") util.printReplacement("structuredReplacementStripsTypeTrivia", function(cst) return query.findAllFromRoot(cst, syntaxUtils.isTypeReference):replace(function(_) return syntaxUtils.replacementWit...
76
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/snapshots/printer/util.luau
luau
.luau
local fs = require("@std/fs") local printer = require("@std/syntax/printer") local syntax = require("@std/syntax") local syntaxTypes = require("@std/syntax/types") local util = {} function util.printReplacement(testName: string, transformFn: (syntax.CstStatBlock) -> syntaxTypes.Replacements) local inFile = `./tests/...
128
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/syntax/utils.test.luau
luau
.luau
local test = require("@std/test") local syntax = require("@std/syntax") local query = require("@std/syntax/query") local utils = require("@std/syntax/utils") test.suite("Utils", function(suite) suite:case("isRequireCall", function(assert) local cst1 = syntax.parse('local x = require("module")') local results = qu...
173
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/tableext.test.luau
luau
.luau
local tableext = require("@std/tableext") local test = require("@std/test") test.suite("TableExt", function(suite) suite:case("mapAndFilter", function(assert) local t: { [string]: number } = { a = 1, b = 2, c = 3 } local mapped = tableext.map(t, function(v: number) return v * 2 end) assert.eq(mapped.a, 2) ...
3,293
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/test.test.luau
luau
.luau
local testtypes = require("@std/test/types") local fs = require("@std/fs") local path = require("@std/path") local process = require("@std/process") local system = require("@std/system") local test = require("@std/test") local lutePath = path.format(process.execPath()) local tmpDir = system.tmpdir() local function as...
2,408
luau-lang/lute
luau-lang-lute-c57dec9/tests/std/time.test.luau
luau
.luau
-- lute-lint-global-ignore(divide_by_zero) local test = require("@std/test") local time = require("@std/time") local duration = time.duration test.suite("TimeSuite", function(suite) suite:case("constructorsSecondsMillisMicroNanos", function(assert) -- seconds local d1 = duration.seconds(5) assert.eq(d1:toMilli...
1,791
luau-lang/lute
luau-lang-lute-c57dec9/tests/testutil.luau
luau
.luau
local testutil = {} function testutil.normalizeLineEndings(contents: string): string local noCrlf, _ = contents:gsub("\r+\n", "\n") local noCr, _ = noCrlf:gsub("\r+", "\n") return noCr end return table.freeze(testutil)
67
luau-lang/lute
luau-lang-lute-c57dec9/tools/bench-toml.luau
luau
.luau
-- Benchmark the @batteries/toml deserializer against the toml-test corpus. -- Run from the repo root: -- lute tools/luthier run lute tools/bench-toml.luau local toml = require("../batteries/toml") local fs = require("@std/fs") local function collectTomlFiles(dir: string, results: { string }): () local entries = f...
493
luau-lang/lute
luau-lang-lute-c57dec9/tools/check.luau
luau
.luau
local cli = require("@batteries/cli") local fs = require("@std/fs") local path = require("@std/path") local process = require("@std/process") local tbl = require("@std/tableext") local difftext = require("@batteries/difftext") local FAILLIST_PATH = "tools/check-faillist.txt" local TYPECHECK_PATHS = { "examples", "l...
1,447
luau-lang/lute
luau-lang-lute-c57dec9/tools/profile.luau
luau
.luau
local task = require("@lute/task") local started = os.clock() local amount = 100000 local batches = 5 local per_batch = amount / batches for current = 1, batches do local thread = coroutine.running() print(`Batch {current} / {batches}`) for i = 1, per_batch do --print("Spawning thread #" .. i) task.spawn(fu...
204
seal-runtime/seal
seal-runtime-seal-f6713d8/.seal/config.luau
luau
.luau
local config = { -- entry_path = "./src/main.luau", test_path = "./tests/run.luau", } export type SealConfig = { --- Script that `seal run` runs; usually the entrypoint to your codebase. --- Defaults to `./src/main.luau`. entry_path: string?, --- Script that `seal test` runs; usually a test run...
97
seal-runtime/seal
seal-runtime-seal-f6713d8/.seal/guided_tour.luau
luau
.luau
--!nolint ImportUnused --!nolint LocalUnused --!nolint LocalShadow -- hi!! welcome to sealey runtime ᶘ ᵔᴥᵔᶅ, here's some basics to get you set up -- Table of Contents (in vscode, ctrl c on a type to teleport there) type TableOfContents = { setup: SealSetupAndRun, fs: Filesystem, env: EnvAndCliArgs, http: HttpRequ...
1,310
seal-runtime/seal
seal-runtime-seal-f6713d8/docs/docscripts/autorun.luau
luau
.luau
-- Watches ./.seal/typedefs/std for changes and runs reference.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 defs_path = fs.dir.project():join(".seal", "typedefs", "std") --- minimum t...
526
seal-runtime/seal
seal-runtime-seal-f6713d8/docs/docscripts/fix_stragglers.luau
luau
.luau
local fs = require("@std/fs") --- semver is very cursed so we reparse the outputted md local function fix_semver() local path = "./docs/reference/std/semver.md" local lines: { string } = {} local skipping = false for _, line in fs.readlines(path) do if line == "## `export type` ...
306
seal-runtime/seal
seal-runtime-seal-f6713d8/examples/older_than_a_week.luau
luau
.luau
-- script that removes files older than n weeks (from provided user input) local fs = require("@std/fs") local err = require("@std/err") local args = require("@std/args") local datetime = require("@std/datetime") -- Usage: seal ./path/to/script <path> <weeks> local parsed = args.parse("rmbald", "removes files at <pat...
434
seal-runtime/seal
seal-runtime-seal-f6713d8/examples/show_keycodes.luau
luau
.luau
-- show all pressed keys on linux local env = require("@std/env") local process = require("@std/process") if env.os ~= "Linux" then error("not supported") end local child = process.spawn { program = "libinput debug-events --show-keycodes", shell = "sh", } :: process.PipedChild -- ensure seal's running i...
144
seal-runtime/seal
seal-runtime-seal-f6713d8/examples/task_runner.luau
luau
.luau
-- A simple interactive task runner: pick a task from a menu and run it. -- Copy and adapt the `tasks` table for your own project. local process = require("@std/process") local prompt = require("@std/io/prompt") local colors = require("@std/io/colors") type Task = { label: string, cmd: string, } local tasks:...
233
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/documentation/comments.luau
luau
.luau
--!nolint FunctionUnused local fs = require("@std/fs") local parser = require("@libraries/LuauParser/Parser") local path = "" const function update_path(p: string) path = string.gsub(p, fs.path.cwd(), ".") end export class BlockComment public start: vector public finish: vector function new(begin_col...
701
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/documentation/fix.luau
luau
.luau
local fs = require("@std/fs") local str = require("@std/str") const path = fs.path.join(script:parent(), "components.luau") const lines = {} for _, line in fs.readlines(path) do if str.startswith(line, "class") then print(line) line = "export " .. line end table.insert(lines, line) end fs.w...
94
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/documentation/parse.luau
luau
.luau
--!optimize 2 local parser = require("@libraries/LuauParser/Parser") local fs = require("@std/fs") local format = require("@std/io/format") local str = require("@std/str") const syntax = require("@libraries/LuauParser/Parser/Syntax") const components = require("./components") const Documentation = components.Document...
1,484
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/libraries/LuauParser/Parser/Confusables.luau
luau
.luau
--!optimize 2 --!strict return { [34] = '"', [48] = "O", [49] = "l", [73] = "l", [96] = "'", [109] = "rn", [124] = "l", [160] = " ", [180] = "'", [184] = ",", [198] = "AE", [215] = "x", [230] = "ae", [305] = "i", [306] = "lJ", [307] = "ij", [329] = "'n", [338] = "OE", [339] = "oe", [383] = "f", [3...
16,167
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/newest_seal.luau
luau
.luau
-- finds whichever seal build is newest for precommit hook const fs = require("@std/fs") const env = require("@std/env") const datetime = require("@std/time/datetime") const base_seal = env.executable_path const seal_options = { "./target/release/seal", "./target/debug/seal" } const function get_modified_tim...
217
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/precommit.luau
luau
.luau
-- This script is run by seal's git pre-commit hook to keep README.md up to date. -- It updates version badges and the handcrafted error message count in-place, -- and installs the hook itself on first run. local fs = require("@std/fs") local env = require("@std/env") local process = require("@std/process") local str ...
1,125
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/signature_generation/apply.luau
luau
.luau
-- Replaces c"..." signature literals in Rust source with signatures::STD_* constants. -- Run after generate.luau whenever typedefs change. local fs = require("@std/fs") local colors = require("@std/io/colors") local REPO_ROOT = fs.path.project() assert(REPO_ROOT) local SRC_DIR = REPO_ROOT .. "/src" local SIGNATURES_...
1,199
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/signature_generation/discovery.luau
luau
.luau
-- Shared typedef auto-discovery for generate.luau and validate.luau. -- Scans .seal/typedefs/std/** and produces typed entries describing each -- extractable prefix (module functions and class methods). local parser = require("@libraries/LuauParser/Parser") local fs = require("@std/fs") local REPO_ROOT = fs.path.pro...
5,185
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/signature_generation/generate.luau
luau
.luau
-- Auto-generates src/signatures.rs from typedef files. -- Run with: seal src/scripts/signature_generation/generate.luau local discovery = require("./discovery") local fs = require("@std/fs") local colors = require("@std/io/colors") local OUTPUT_PATH = discovery.REPO_ROOT .. "/src/signatures.rs" -- ── Constant name ...
625
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/signature_generation/validate.luau
luau
.luau
-- Validates that Rust with_function_and_signature calls match the typedef files. -- Run with: seal src/scripts/signature_generation/validate.luau local discovery = require("./discovery") local fs = require("@std/fs") local colors = require("@std/io/colors") local SRC_DIR = discovery.REPO_ROOT .. "/src" -- ── Build ...
1,601
seal-runtime/seal
seal-runtime-seal-f6713d8/src/scripts/tabsbad.luau
luau
.luau
local fs = require("@std/fs") local typedefs = fs.dir.project():join(".seal", "typedefs") local files_with_tabs: { string } = {} local path_sub_out = fs.path.join(fs.path.cwd(), ".seal", "typedefs") for _, file in fs.listdir(typedefs, true) do for _, line in fs.readlines(file) do if string.match(line, "...
126
seal-runtime/seal
seal-runtime-seal-f6713d8/src/setup/default_config.luau
luau
.luau
local config = { entry_path = "./src/main.luau", test_path = "./tests/run.luau", seal_version = "<SEAL_VERSION_REPLACE>" } export type SealConfig = { --- Script that `seal run` runs; usually the entrypoint to your codebase. --- Defaults to `./src/main.luau`. entry_path: string?, --- Script ...
129
seal-runtime/seal
seal-runtime-seal-f6713d8/src/setup/regen.luau
luau
.luau
local colors = require("@std/colors") local env = require("@std/env") local fs = require("@std/fs") local prompt = require("@std/io/prompt") local luau = require("@std/luau") local process = require("@std/process") local semver = require("@std/semver") local seal_setup = (require :: any)("@internal/setup") :: { ex...
1,392
seal-runtime/seal
seal-runtime-seal-f6713d8/src/std_fs/read_tree.luau
luau
.luau
-- doesn't make sense to write in Rust local fs = require("@std/fs") type TreeResult = { tree: fs.DirectoryTree } | { err: string } local function readtree(path: string): TreeResult local directory_tree = {} for p, entry in fs.entries(path) do if entry.type == "File" then (table.insert :: any)(directory_tre...
220
seal-runtime/seal
seal-runtime-seal-f6713d8/src/std_io/formatter.luau
luau
.luau
--!optimize 2 --!nolint LocalShadow --[[ doing highly recursive operations + lots of table iteration is faster directly in luau rather than through mlua's interop layer, which, among other things, has additional safety costs associated with iterating through tables ]] const mlua = require("@interop/mlua") ...
7,917
seal-runtime/seal
seal-runtime-seal-f6713d8/src/std_terminal/events/interrupt_check.luau
luau
.luau
local err = require("@std/err") export type KeyModifiers = { ctrl: boolean, shift: boolean, alt: boolean, } export type KeyEvent = { type: "Key", key: string, kind: string, modifiers: KeyModifiers, } export type MouseEvent = { type: "Mouse", kind: string, position: vector, m...
369
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/.config.luau
luau
.luau
return { luau = { aliases = { thing = "./data/thingresolvedfromdotconfig", basic = "./data/bundle_projects/basic" } } }
38
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/cheese.luau
luau
.luau
local err = require("@std/err") local cheese = {} function cheese.retry(f: () -> (any), tries: number?) tries = tries or 3 local current = 0 local last_err: error while current < tries do local success, err = pcall(f) if success then return else last_err ...
130
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/basic/dep.luau
luau
.luau
return { message = "hello from dep" }
10
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/basic/main.luau
luau
.luau
local dep = require("./dep") return dep.message
11
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/inlineable/check.luau
luau
.luau
local str = require("@std/str") local function check_url(location: string): string local url = location if not str.startswith(location, "https://") then url = "https://" .. url end return url end local function check_compat(url: string) return true end return { url = check_url, com...
85
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/long_string/main.luau
luau
.luau
-- simulates what a file looks like after being bundled once with thread.spawn path inlining: -- the require inside the long string is inlined source code and must not be replaced when bundled again local inlined_src = [=====[ local some_module = require("./some_module") return some_module.value ]=====] return inlined_...
70
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/lsl/src/get_size_of_directory.luau
luau
.luau
local fs = require("@std/fs") --- recursively gets size of `dir` in bytes --- returns (partial size, error) if any subdirectories were inaccessible, otherwise (full size, nil) local function get_size_of_directory(dir: string): (number, string?) local ok, paths = pcall(fs.listdir, dir) if not ok then re...
296
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/lsl/src/main.luau
luau
.luau
--!optimize 2 local fs = require("@std/fs") local args = require("@std/args") local colors = require("@std/io/colors") local env = require("@std/env") local base64 = require("@std/serde/base64") local json = require("@std/json") local str = require("@std/str") local thread = require("@std/thread") local datetime = req...
2,662
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/lsl/src/sizer.luau
luau
.luau
local fs = require("@std/fs") --- recursively gets size of `dir` in bytes --- returns (partial size, error) if any subdirectories were inaccessible, otherwise (full size, nil) local function get_size_of_directory(dir: string): (number, string?) local ok, paths = pcall(fs.listdir, dir) if not ok then re...
339
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/quoted_string/main.luau
luau
.luau
-- these require() calls are inside regular quoted strings and must not be bundled local double_quoted = "local db = require('./database')" local single_quoted = 'local fs = require("@std/fs")' return { double_quoted = double_quoted, single_quoted = single_quoted }
62
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/repeated_dependencies/core.luau
luau
.luau
local core = {} core.version = _SEAL_VERSION core.environment = require("@std") function core.dependencies() return { "luau", "seal", "python", "uv" } end return core
50
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/repeated_dependencies/helper.luau
luau
.luau
local core = require("./core") local dependencies = core.dependencies() print(`dependencies: {table.concat(dependencies, ", ")}`) return { got_dependencies = dependencies }
36
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/bundle_projects/repeated_dependencies/main.luau
luau
.luau
local helper = require("./helper") local core = require("./core") print(helper.got_dependencies) print(core.version)
24
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/data/thingresolvedfromdotconfig.luau
luau
.luau
return { "hi i was resolved from .config.luau" }
15
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/errors/another_module.luau
luau
.luau
local fs = require("@std/fs") local module = {} function module.execute() error("hi") -- print(debug.traceback()) end function module.readimpossiblefile() return fs.readfile("./hmm") end return module
48
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/errors/errors.luau
luau
.luau
-- TODO: properly test errors without making tests too brittle -- local mlua = require("@interop/mlua") local module = require("./another_module") local function main() script.context = "rfing" module.readimpossiblefile() return module.execute() end local success, result = pcall(main :: any) -- assert(mlua.iserror...
81
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/extra/test_csv.luau
luau
.luau
-- TODO, actually fill out the unit tests local str = require("@std/str") local path = require("@std/fs/path") local csv = require("@extra/csv") local csv_data_path = path.join(".", "tests", "data", "csv_data") -- just being able to read and parse these files means it handles utf8 and emojis correctly local courses =...
473
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/globals.luau
luau
.luau
--!nocheck local env = require("@std/env") -- does _G exist and can we do things to it assert(_G ~= nil, "why doesn't _G exist??") _G.hmm = "_hmm" assert(_G.hmm == "_hmm", "can't assign simple variable to _G") -- do regular globals work? meow = 2 assert(meow == 2, "assignment to globals borked") local reserved = (re...
233
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/output.luau
luau
.luau
local meow = { fed = false, data = { ["/opt/idk/2"] = "safe", }, cats = { Taz = 1, Nan = 2, }, doer = function() end, [{ "i am a key" }] = true, [1.25] = 1, [vector.create(1, 2, 2312311.23)] = 12, } meow.a = meow meow.cats.newcat = meow.cats meow....
976
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/basic-requires/basic_requires.luau
luau
.luau
--!nolint ImportUnused local fs = require("@std/fs") local env = require("@std/env") local process = require("@std/process") local basic_requires_dir = fs.dir.from(script:parent()) local function dirwithinit() local canweinitdir = fs.dir.ensure(basic_requires_dir:join("canweinit")) :add_file("init.luau", 'return "...
972
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/basic-requires/relative_data.luau
luau
.luau
local data = { relative = "yes very", callme = function() return "maybe" end } return data
26
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/cached-requires/helper.luau
luau
.luau
local colors = require("@std/colors") local state = require("./state") local helper = {} function helper.formatname(): string if state.data.name then return `@{colors.blue(state.data.name :: any)}` else error("state.data.name doesn't exist") end end function helper.changename(new_name: string) state.data.nam...
83
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/cached-requires/main.luau
luau
.luau
local colors = require("@std/colors") local state = require("./state") state.data.name = "seal" local helper = require("./helper") assert(helper.formatname() == `@{colors.blue("seal")}`, "state change 1 didnt work") helper.changename("meow") assert(helper.formatname() == `@{colors.blue("meow")}`, "state change 2 did...
86
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/cached-requires/state.luau
luau
.luau
local state = {} state.enabled = false state.data = {} :: {[any]: any} return state
21
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/nopanic.luau
luau
.luau
local s, r = pcall(function() return (require :: any)("./meow!/./*") end) if typeof(r) == "error" then if tostring(r):match("PANIC") then error(`we panicked but managed to catch the panic (crazy): {r}`) else -- we good end else error(`wtf this was supposed to error but actually got:...
98
seal-runtime/seal
seal-runtime-seal-f6713d8/tests/luau/globals/require/resolver_tests.luau
luau
.luau
local fs = require("@std/fs") local resolver_src: string = "" do local resolver_dot_luau_path = fs.path.join(".", "src", "require", "resolver.luau") resolver_src = fs.readfile(resolver_dot_luau_path) end -- hope for/assume this works; if not well test should fail lol local resolver = require("./../../../../src/requ...
1,211
seal-runtime/seal
seal-runtime-seal-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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-f6713d8/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