local START_TIME = tick() local rawResults = {} local metaInfo = {} local function addResult(name, ok, info) if rawResults[name] ~= nil then return end rawResults[name] = { passed = ok and true or false, info = info or "" } end local function safeAssert(name, fn, failReason) local ok, err = pcall(fn) if not ok then addResult(name, false, failReason or tostring(err)) return false, err else if rawResults[name] == nil then addResult(name, true, "ok") end return true end end local function checkExists(path) local env = getgenv and getgenv() or _G local cur = env for seg in string.gmatch(path, "[^%.]+") do if type(cur) ~= "table" then return false end cur = cur[seg] if cur == nil then return false end end return true end local function quickBoolTest(name, cond, reason) if cond then addResult(name, true, "ok") else addResult(name, false, reason or "failed") end end local function getExecutorName() local n = nil local ok = pcall(function() if getexecutorname then n = getexecutorname() elseif identifyexecutor then local a, b = identifyexecutor() n = a or b elseif syn then n = "Synapse (syn)" end end) if not ok then n = nil end if type(n) ~= "string" then n = "Unknown" end return n end metaInfo.executor = getExecutorName() local featureTargets = { "loadstring", "getgenv", "getrenv", "getgc", "getrunningscripts", "getscripts", "getscripthash", "getsenv", "getrawmetatable", "setreadonly", "isreadonly", "newcclosure", "iscclosure", "islclosure", "isexecutorclosure", "hookfunction", "hookmetamethod", "getnamecallmethod", "setrawmetatable", "getinstances", "getnilinstances", "isscriptable", "setscriptable", "getthreadidentity", "setthreadidentity", "checkcaller", "request", "getcustomasset", "gethiddenproperty", "sethiddenproperty", "Drawing.new", "Drawing.Fonts", "getrenderproperty", "setrenderproperty", "cleardrawcache", "listfiles", "isfolder", "isfile", "makefolder", "writefile", "appendfile", "readfile", "delfile", "delfolder", "loadfile", "getscriptbytecode" } for _, path in ipairs(featureTargets) do local exists = checkExists(path) if exists then addResult(path, true, "exists") else addResult(path, false, "missing") end end if getgenv then safeAssert("getgenv[behavior]", function() local a = getgenv() local b = getgenv() assert(a == b, "environments not identical") a.__SUNC_TEMP = 99 assert(getgenv().__SUNC_TEMP == 99, "value not shared") a.__SUNC_TEMP = nil end, "environment not stable") end if loadstring then safeAssert("loadstring[basic]", function() local f = loadstring("return 10 + 5") assert(type(f) == "function", "loadstring returned non-function") assert(f() == 15, "math result mismatch") end, "simple expression failed") safeAssert("loadstring[error-report]", function() local ok, err = pcall(function() local f = loadstring("this is not valid luau") f() end) assert(ok == false, "invalid chunk did not error") assert(type(err) == "string" or type(err) == "table", "no error info returned") end, "invalid-chunk handling broken") end if getrawmetatable and setreadonly and hookmetamethod then safeAssert("metatable[hook]", function() local obj = {} local mt = getrawmetatable(obj) or {} local oldIndex = mt.__index local wr = pcall(function() setreadonly(mt, false) end) assert(wr, "setreadonly failed") mt.__index = function(self, k) if k == "__SUNC_FLAG" then return "OK" end if oldIndex then return oldIndex(self, k) end return nil end setreadonly(mt, true) local hook hook = hookmetamethod(obj, "__index", function(self, k, ...) if k == "__SUNC_HOOKED" then return "HOOKED" end return hook(self, k, ...) end) assert(obj.__SUNC_FLAG == "OK", "original index override failed") assert(obj.__SUNC_HOOKED == "HOOKED", "__index hook failed") end, "metamethod / readonly behavior invalid") end if newcclosure and iscclosure and islclosure then safeAssert("closures[type]", function() local luaFunc = function() return 1 end local cFunc = newcclosure(luaFunc) assert(luaFunc() == cFunc(), "closure return mismatch") assert(luaFunc ~= cFunc, "closure should not be same reference") assert(iscclosure(cFunc), "cFunc not reported as cclosure") assert(islclosure(luaFunc), "luaFunc not reported as lclosure") end, "closure typing broken") end if checkcaller then safeAssert("checkcaller[basic]", function() assert(checkcaller() == true, "checkcaller should be true in user script") end, "checkcaller returned false") end if getthreadidentity and setthreadidentity then safeAssert("threadidentity", function() local original = getthreadidentity() assert(type(original) == "number", "identity not number") setthreadidentity(original + 1) assert(getthreadidentity() == original + 1, "identity did not change") setthreadidentity(original) end, "thread identity operations blocked") end if isfolder and makefolder and delfolder and writefile and readfile and isfile and listfiles then safeAssert("filesystem", function() local root = ".sunc_test" if isfolder(root) then delfolder(root) end makefolder(root) assert(isfolder(root), "folder not created") local f1 = root .. "/a.txt" writefile(f1, "hello") assert(isfile(f1), "file not created") assert(readfile(f1) == "hello", "content mismatch") if appendfile then appendfile(f1, " world") assert(readfile(f1) == "hello world", "appendfile broken") end if loadfile then local f2 = root .. "/code.lua" writefile(f2, "return function(x) return x + 3 end") local loader = loadfile(f2) local fn = loader() assert(fn(5) == 8, "loadfile function incorrect") end local entries = listfiles(root) assert(type(entries) == "table" and #entries >= 1, "listfiles empty") delfile(f1) assert(not isfile(f1), "delfile failed") delfolder(root) assert(not isfolder(root), "delfolder failed") end, "filesystem operations failed") end if request then safeAssert("request[basic]", function() local res = request({ Url = "https://httpbin.org/get", Method = "GET" }) assert(type(res) == "table", "response not table") assert(res.StatusCode == 200 or res.StatusCode == 301 or res.StatusCode == 302, "unexpected status") end, "HTTP request failed") end if getcustomasset and writefile then safeAssert("getcustomasset[basic]", function() local path = ".sunc_asset_test.txt" writefile(path, "x") local id = getcustomasset(path) assert(type(id) == "string" and #id > 0, "asset id invalid") end, "getcustomasset not usable") end if gethiddenproperty and sethiddenproperty then safeAssert("hiddenprops", function() local fire = Instance.new("Fire") local okA = pcall(function() return gethiddenproperty(fire, "size_xml") end) assert(okA, "gethiddenproperty errored") local okB = pcall(function() sethiddenproperty(fire, "size_xml", 7) end) assert(okB, "sethiddenproperty errored") end, "hidden property functions broken") end if Drawing and Drawing.new then safeAssert("Drawing[objects]", function() local sq = Drawing.new("Square") sq.Visible = true sq.Color = Color3.fromRGB(255, 255, 255) sq.Size = Vector2.new(50, 50) if getrenderproperty then local v = getrenderproperty(sq, "Visible") assert(type(v) == "boolean", "Visible not boolean") end if setrenderproperty then setrenderproperty(sq, "Visible", false) assert(sq.Visible == false, "setrenderproperty failed") end local okDestroy = pcall(function() sq:Remove() end) if not okDestroy then pcall(function() sq:Destroy() end) end end, "Drawing api failure") if Drawing.Fonts then quickBoolTest("Drawing.Fonts[exists]", Drawing.Fonts.UI ~= nil, "fonts missing") end if cleardrawcache then local ok = pcall(function() cleardrawcache() end) quickBoolTest("cleardrawcache[call]", ok, "cleardrawcache threw error") end end if getscriptbytecode and getscripthash then safeAssert("script[introspection]", function() local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local anim = char:FindFirstChildOfClass("LocalScript") or char:FindFirstChild("Animate") assert(anim, "no local script found on character") local bc = getscriptbytecode(anim) assert(type(bc) == "string" and #bc > 0, "bytecode empty") local h1 = getscripthash(anim) local src = anim.Source anim.Source = src .. "\n-- sunc test" local h2 = getscripthash(anim) anim.Source = src assert(h1 ~= h2, "hash not sensitive to source change") end, "script hash / bytecode invalid") end if getrunningscripts and getscripts then safeAssert("scripts[lists]", function() local rs = getrunningscripts() assert(type(rs) == "table", "getrunningscripts not table") assert(#rs > 0, "no running scripts listed") local all = getscripts() assert(type(all) == "table" and #all > 0, "getscripts empty") end, "script listing broken") end if getinstances then safeAssert("getinstances[basic]", function() local insts = getinstances() assert(type(insts) == "table" and #insts > 0, "getinstances empty") assert(insts[1].ClassName ~= nil, "first entry not instance") end, "getinstances failed") end if getnilinstances then safeAssert("getnilinstances[basic]", function() local insts = getnilinstances() if #insts > 0 then assert(insts[1].Parent == nil, "nil instance not parentless") end end, "getnilinstances failed") end local sorted = {} for name, data in pairs(rawResults) do table.insert(sorted, {name = name, passed = data.passed, info = data.info}) end table.sort(sorted, function(a, b) return a.name < b.name end) local total = #sorted local passed = 0 for _, r in ipairs(sorted) do if r.passed then passed = passed + 1 end end local successRate = 0 if total > 0 then successRate = math.floor((passed / total) * 100 + 0.5) end local elapsed = tick() - START_TIME local function formatTime(t) return math.floor(t * 10) / 10 end local function speedComment(t) if t < 2 then return "Very fast – environment is highly responsive." elseif t < 4 then return "Fast – should feel smooth in most usage." elseif t < 7 then return "Average – okay for general use, heavy tests may feel slower." elseif t < 10 then return "Slow – complex scripts may feel laggy." else return "Very slow – environment is struggling with heavy checks." end end print("========== sUNC Test Made by 28e5 ==========") print("Executor: " .. tostring(metaInfo.executor)) print(string.format("Checks passed: %d / %d (%d%%)", passed, total, successRate)) print(string.format("Time: %.1fs", formatTime(elapsed))) print(speedComment(elapsed)) print("-------------------------------------------") for _, r in ipairs(sorted) do local tag = r.passed and "[+]" or "[-]" local msg = r.info and tostring(r.info) or "" print(string.format("%s %s - %s", tag, r.name, msg)) end print("===========================================")