Skip to content

Instantly share code, notes, and snippets.

@depthso
Last active July 25, 2026 16:37
Show Gist options
  • Select an option

  • Save depthso/8082e52f70bee23c5465568fade50c4f to your computer and use it in GitHub Desktop.

Select an option

Save depthso/8082e52f70bee23c5465568fade50c4f to your computer and use it in GitHub Desktop.
Roblox executor test for implementations of the env, this is different to a "UNC" test. Higher fails = worse executor
--[[
@author depthso/depso
@description Roblox Executor test for implimentations
]]
--// Config
const Delay = 0
--// Variables
local Total, Passed, Undefined = 0, 0, 0
const VENV = getfenv(0)
--// types
type Function = (...unknown) -> ... unknown
type Callback = () -> boolean|string
const function IsCFunction(Closure: Function): boolean
if pcall(function()
setfenv(Closure, getfenv(Closure))
end) then
return false
end
const L, S = debug.info(Closure, "ls")
if L ~= -1 or S ~= "[C]" then return false end
return true
end
const function BuildFunctionHash(Closure: Function): string
return table.concat({debug.info(Closure, "snlaf")}, "")
end
@native const function CompareFunctions(A: Function, B: Function): boolean
return A == B or BuildFunctionHash(A) == BuildFunctionHash(B)
end
@native const function TestAliases(Aliases: {string}): {string}
const MissingAliases = {}
for _, Alias in next, Aliases do
if not VENV[Alias] then
Undefined += 1
table.insert(MissingAliases, Alias)
end
end
return MissingAliases
end
@native const function Test(Name: string, Callback: Callback)
Total += 1
--// Test delay
if Total > 1 and Delay > 0 then
task.wait(Delay)
end
const CallSuccess, Return = pcall(Callback)
--// Unsuccessful
if not CallSuccess or Return ~= true then
warn("⛔", Name, "failed:", Return)
return
end
--// Passed
Passed += 1
print("✅", Name)
return
end
@native const function TestGlobal(Global: string, Aliases: {string}, Callback: Callback)
--// Has global
if not VENV[Global] then
warn("⛔", Global)
return
end
--// Alias check
const MissingAliases = TestAliases(Aliases)
if #MissingAliases > 0 then
warn("⚠️", table.concat(MissingAliases, ", "))
return
end
return Test(Global, Callback)
end
@native const function PrintSummary()
const SuccessRate = math.round(Passed / Total * 100)
const Failed = Total - Passed
print("Test Summary")
print(string.rep("-", 50))
print(`✅ Tested with a {SuccessRate}% success rate`)
print(`⛔ {Failed} tests failed`)
print(`⚠️ {Undefined} globals are missing aliases`)
return
end
@native const function PrinHeader()
print([[
Shit Environment Check
✅ - Pass, ⛔ - Fail, ⏺️ - No test, ⚠️ - Missing aliases]])
print("Executor:", identifyexecutor())
print(string.rep("-", 50), "\n")
task.wait(1)
return
end
--// Header
PrinHeader()
--// Tests
Test("HttpGetAsync", function()
--// Field test
if pcall(function()
return workspace:HttpGetAsync("https://google.com")
end) then
return "Terrible HttpGetAsync field/hook 😭"
end
--// C closure test
if not IsCFunction(game.HttpGetAsync) then
return "HttpGetAsync should be a valid C function"
end
--// Comparsion
if CompareFunctions(game.HttpGetAsync, game.HttpGet) then
return "HttpGetAsync should differ from HttpGet"
end
--// Return check
const Return = game:HttpGetAsync("https://google.com")
if typeof(Return) ~= "string" or #Return < 10 then
return "https://google.com/ did not return anything"
end
return true
end)
Test("env.__newindex", function() -- Potassium used to fail this lmao
const Previous = require
getgenv().require = warn
const New = getgenv().require
getgenv().require = Previous
--// Protected function swap
if New == Previous then
return "Value did not change for 'require'"
end
return true
end)
Test("env.script", function()
return typeof(script) == "Instance" and script.Parent == nil
end)
TestGlobal("hookfunction", {}, function()
--// Executor function hooking
hookfunction(hookfunction, function()
return "abc"
end)
--// Return check
const Success, Return = pcall(hookfunction)
if not Success or Return ~= "abc" then
return "hookfunction was not hooked"
end
restorefunction(hookfunction)
--// Error check
-- local Previous; Previous = hookfunction(writefile, newcclosure(function()
-- return error("Jit")
-- end))
return true
end)
TestGlobal("hookmetamethod", {}, function()
const Timeout = 5
local Return, IsRunning = false, false
--// WaitForChild test
const Thread = task.spawn(function()
IsRunning = true
Return = workspace:WaitForChild("SkibidiDepso", Timeout)
end)
--// Wait for thread
repeat task.wait() until IsRunning
--// Hook
local Previous; Previous = hookmetamethod(game, "__namecall", function(...)
return Previous(...)
end)
task.wait(Timeout+1)
--// Return check
if Return then
return "Yield should have not returned anything"
end
--// Thread state check
if Return ~= nil or coroutine.status(Thread) ~= "dead" then
return "Yield never completed when hooked"
end
return true
end)
--// Done
PrintSummary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment