NoTextForSpeech

Unc test (1 LINE)

May 22nd, 2024
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.49 KB | None | 0 0
  1. local a,b,c=0,0,0;local d=0;local function e(f)local g=getfenv(0)while g~=nil and f~=""do local h,i=string.match(f,"^([^.]+)%.?(.*)$")g=g[h]f=i end;return g end;local function j(h,k,l)d=d+1;task.spawn(function()if not l then print("⏺️ "..h)elseif not e(h)then b=b+1;warn("⛔ "..h)else local m,n=pcall(l)if m then a=a+1;print("✅ "..h..(n and" • "..n or""))else b=b+1;warn("⛔ "..h.." failed: "..n)end end;local o={}for p,q in ipairs(k)do if e(q)==nil then table.insert(o,q)end end;if#o>0 then c=c+1;warn("⚠️ "..table.concat(o,", "))end;d=d-1 end)end;print("UNC Environment Check")print("✅ - Pass, ⛔ - Fail, ⏺️ - No test, ⚠️ - Missing aliases\n")task.defer(function()repeat task.wait()until d==0;local r=math.round(a/(a+b)*100)local s=a.." out of "..a+b;print("\n")print("UNC Summary")print("✅ Tested with a "..r.."% success rate ("..s..")")print("⛔ "..b.." tests failed")print("⚠️ "..c.." globals are missing aliases")end)j("cache.invalidate",{},function()local t=Instance.new("Folder")local u=Instance.new("Part",t)cache.invalidate(t:FindFirstChild("Part"))assert(u~=t:FindFirstChild("Part"),"Reference `part` could not be invalidated")end)j("cache.iscached",{},function()local u=Instance.new("Part")assert(cache.iscached(u),"Part should be cached")cache.invalidate(u)assert(not cache.iscached(u),"Part should not be cached")end)j("cache.replace",{},function()local u=Instance.new("Part")local v=Instance.new("Fire")cache.replace(u,v)assert(u~=v,"Part was not replaced with Fire")end)j("cloneref",{},function()local u=Instance.new("Part")local w=cloneref(u)assert(u~=w,"Clone should not be equal to original")w.Name="Test"assert(u.Name=="Test","Clone should have updated the original")end)j("compareinstances",{},function()local u=Instance.new("Part")local w=cloneref(u)assert(u~=w,"Clone should not be equal to original")assert(compareinstances(u,w),"Clone should be equal to original when using compareinstances()")end)local function x(y,z)if y==z then return true end;local A={["function"]=true,["table"]=true,["userdata"]=true,["thread"]=true}for B,C in pairs(y)do if A[type(C)]then if type(z[B])~=type(C)then return false end elseif z[B]~=C then return false end end;for B,C in pairs(z)do if A[type(C)]then if type(z[B])~=type(C)then return false end elseif y[B]~=C then return false end end;return true end;j("checkcaller",{},function()assert(checkcaller(),"Main scope should return true")end)j("clonefunction",{},function()local function j()return"success"end;local D=clonefunction(j)assert(j()==D(),"The clone should return the same value as the original")assert(j~=D,"The clone should not be equal to the original")end)j("getcallingscript",{})j("getscriptclosure",{"getscriptfunction"},function()local E=game:GetService("CoreGui").RobloxGui.Modules.Common.Constants;local F=getrenv().require(E)local G=getscriptclosure(E)()assert(F~=G,"Generated module should not match the original")assert(x(F,G),"Generated constant table should be shallow equal to the original")end)j("hookfunction",{"replaceclosure"},function()local function j()return true end;local H=hookfunction(j,function()return false end)assert(j()==false,"Function should return false")assert(H()==true,"Original function should return true")assert(j~=H,"Original function should not be same as the reference")end)j("iscclosure",{},function()assert(iscclosure(print)==true,"Function 'print' should be a C closure")assert(iscclosure(function()end)==false,"Executor function should not be a C closure")end)j("islclosure",{},function()assert(islclosure(print)==false,"Function 'print' should not be a Lua closure")assert(islclosure(function()end)==true,"Executor function should be a Lua closure")end)j("isexecutorclosure",{"checkclosure","isourclosure"},function()assert(isexecutorclosure(isexecutorclosure)==true,"Did not return true for an executor global")assert(isexecutorclosure(newcclosure(function()end))==true,"Did not return true for an executor C closure")assert(isexecutorclosure(function()end)==true,"Did not return true for an executor Luau closure")assert(isexecutorclosure(print)==false,"Did not return false for a Roblox global")end)j("loadstring",{},function()local I=game:GetService("Players").LocalPlayer.Character.Animate;local J=getscriptbytecode(I)local K=loadstring(J)assert(type(K)~="function","Luau bytecode should not be loadable!")assert(assert(loadstring("return ... + 1"))(1)==2,"Failed to do simple math")assert(type(select(2,loadstring("f")))=="string","Loadstring did not return anything for a compiler error")end)j("newcclosure",{},function()local function j()return true end;local L=newcclosure(j)assert(j()==L(),"New C closure should return the same value as the original")assert(j~=L,"New C closure should not be same as the original")assert(iscclosure(L),"New C closure should be a C closure")end)j("rconsoleclear",{"consoleclear"})j("rconsolecreate",{"consolecreate"})j("rconsoledestroy",{"consoledestroy"})j("rconsoleinput",{"consoleinput"})j("rconsoleprint",{"consoleprint"})j("rconsolesettitle",{"rconsolename","consolesettitle"})j("crypt.base64encode",{"crypt.base64.encode","crypt.base64_encode","base64.encode","base64_encode"},function()assert(crypt.base64encode("test")=="dGVzdA==","Base64 encoding failed")end)j("crypt.base64decode",{"crypt.base64.decode","crypt.base64_decode","base64.decode","base64_decode"},function()assert(crypt.base64decode("dGVzdA==")=="test","Base64 decoding failed")end)j("crypt.encrypt",{},function()local M=crypt.generatekey()local N,O=crypt.encrypt("test",M,nil,"CBC")assert(O,"crypt.encrypt should return an IV")local P=crypt.decrypt(N,M,O,"CBC")assert(P=="test","Failed to decrypt raw string from encrypted data")end)j("crypt.decrypt",{},function()local M,O=crypt.generatekey(),crypt.generatekey()local N=crypt.encrypt("test",M,O,"CBC")local P=crypt.decrypt(N,M,O,"CBC")assert(P=="test","Failed to decrypt raw string from encrypted data")end)j("crypt.generatebytes",{},function()local Q=math.random(10,100)local R=crypt.generatebytes(Q)assert(#crypt.base64decode(R)==Q,"The decoded result should be "..Q.." bytes long (got "..#crypt.base64decode(R).." decoded, "..#R.." raw)")end)j("crypt.generatekey",{},function()local M=crypt.generatekey()assert(#crypt.base64decode(M)==32,"Generated key should be 32 bytes long when decoded")end)j("crypt.hash",{},function()local S={"sha1","sha384","sha512","md5","sha256","sha3-224","sha3-256","sha3-512"}for p,T in ipairs(S)do local U=crypt.hash("test",T)assert(U,"crypt.hash on algorithm '"..T.."' should return a hash")end end)j("debug.getconstant",{},function()local function j()print("Hello, world!")end;assert(debug.getconstant(j,1)=="print","First constant must be print")assert(debug.getconstant(j,2)==nil,"Second constant must be nil")assert(debug.getconstant(j,3)=="Hello, world!","Third constant must be 'Hello, world!'")end)j("debug.getconstants",{},function()local function j()local V=5000 ..50000;print("Hello, world!",V,warn)end;local F=debug.getconstants(j)assert(F[1]==50000,"First constant must be 50000")assert(F[2]=="print","Second constant must be print")assert(F[3]==nil,"Third constant must be nil")assert(F[4]=="Hello, world!","Fourth constant must be 'Hello, world!'")assert(F[5]=="warn","Fifth constant must be warn")end)j("debug.getinfo",{},function()local W={source="string",short_src="string",func="function",what="string",currentline="number",name="string",nups="number",numparams="number",is_vararg="number"}local function j(...)print(...)end;local X=debug.getinfo(j)for B,C in pairs(W)do assert(X[B]~=nil,"Did not return a table with a '"..B.."' field")assert(type(X[B])==C,"Did not return a table with "..B.." as a "..C.." (got "..type(X[B])..")")end end)j("debug.getproto",{},function()local function j()local function Y()return true end end;local Y=debug.getproto(j,1,true)[1]local Z=debug.getproto(j,1)assert(Y,"Failed to get the inner function")assert(Y()==true,"The inner function did not return anything")if not Z()then return"Proto return values are disabled on this executor"end end)j("debug.getprotos",{},function()local function j()local function _()return true end;local function a0()return true end;local function a1()return true end end;for a2 in ipairs(debug.getprotos(j))do local Y=debug.getproto(j,a2,true)[1]local Z=debug.getproto(j,a2)assert(Y(),"Failed to get inner function "..a2)if not Z()then return"Proto return values are disabled on this executor"end end end)j("debug.getstack",{},function()local p="a".."b"assert(debug.getstack(1,1)=="ab","The first item in the stack should be 'ab'")assert(debug.getstack(1)[1]=="ab","The first item in the stack table should be 'ab'")end)j("debug.getupvalue",{},function()local a3=function()end;local function j()print(a3)end;assert(debug.getupvalue(j,1)==a3,"Unexpected value returned from debug.getupvalue")end)j("debug.getupvalues",{},function()local a3=function()end;local function j()print(a3)end;local a4=debug.getupvalues(j)assert(a4[1]==a3,"Unexpected value returned from debug.getupvalues")end)j("debug.setconstant",{},function()local function j()return"fail"end;debug.setconstant(j,1,"success")assert(j()=="success","debug.setconstant did not set the first constant")end)j("debug.setstack",{},function()local function j()return"fail",debug.setstack(1,1,"success")end;assert(j()=="success","debug.setstack did not set the first stack item")end)j("debug.setupvalue",{},function()local function a3()return"fail"end;local function j()return a3()end;debug.setupvalue(j,1,function()return"success"end)assert(j()=="success","debug.setupvalue did not set the first upvalue")end)if isfolder and makefolder and delfolder then if isfolder(".tests")then delfolder(".tests")end;makefolder(".tests")end;j("readfile",{},function()writefile(".tests/readfile.txt","success")assert(readfile(".tests/readfile.txt")=="success","Did not return the contents of the file")end)j("listfiles",{},function()makefolder(".tests/listfiles")writefile(".tests/listfiles/test_1.txt","success")writefile(".tests/listfiles/test_2.txt","success")local a5=listfiles(".tests/listfiles")assert(#a5==2,"Did not return the correct number of files")assert(isfile(a5[1]),"Did not return a file path")assert(readfile(a5[1])=="success","Did not return the correct files")makefolder(".tests/listfiles_2")makefolder(".tests/listfiles_2/test_1")makefolder(".tests/listfiles_2/test_2")local a6=listfiles(".tests/listfiles_2")assert(#a6==2,"Did not return the correct number of folders")assert(isfolder(a6[1]),"Did not return a folder path")end)j("writefile",{},function()writefile(".tests/writefile.txt","success")assert(readfile(".tests/writefile.txt")=="success","Did not write the file")local a7=pcall(function()writefile(".tests/writefile","success")assert(isfile(".tests/writefile.txt"))end)if not a7 then return"This executor requires a file extension in writefile"end end)j("makefolder",{},function()makefolder(".tests/makefolder")assert(isfolder(".tests/makefolder"),"Did not create the folder")end)j("appendfile",{},function()writefile(".tests/appendfile.txt","su")appendfile(".tests/appendfile.txt","cce")appendfile(".tests/appendfile.txt","ss")assert(readfile(".tests/appendfile.txt")=="success","Did not append the file")end)j("isfile",{},function()writefile(".tests/isfile.txt","success")assert(isfile(".tests/isfile.txt")==true,"Did not return true for a file")assert(isfile(".tests")==false,"Did not return false for a folder")assert(isfile(".tests/doesnotexist.exe")==false,"Did not return false for a nonexistent path (got "..tostring(isfile(".tests/doesnotexist.exe"))..")")end)j("isfolder",{},function()assert(isfolder(".tests")==true,"Did not return false for a folder")assert(isfolder(".tests/doesnotexist.exe")==false,"Did not return false for a nonexistent path (got "..tostring(isfolder(".tests/doesnotexist.exe"))..")")end)j("delfolder",{},function()makefolder(".tests/delfolder")delfolder(".tests/delfolder")assert(isfolder(".tests/delfolder")==false,"Failed to delete folder (isfolder = "..tostring(isfolder(".tests/delfolder"))..")")end)j("delfile",{},function()writefile(".tests/delfile.txt","Hello, world!")delfile(".tests/delfile.txt")assert(isfile(".tests/delfile.txt")==false,"Failed to delete file (isfile = "..tostring(isfile(".tests/delfile.txt"))..")")end)j("loadfile",{},function()writefile(".tests/loadfile.txt","return ... + 1")assert(assert(loadfile(".tests/loadfile.txt"))(1)==2,"Failed to load a file with arguments")writefile(".tests/loadfile.txt","f")local l,a8=loadfile(".tests/loadfile.txt")assert(a8 and not l,"Did not return an error message for a compiler error")end)j("dofile",{})j("isrbxactive",{"isgameactive"},function()assert(type(isrbxactive())=="boolean","Did not return a boolean value")end)j("mouse1click",{})j("mouse1press",{})j("mouse1release",{})j("mouse2click",{})j("mouse2press",{})j("mouse2release",{})j("mousemoveabs",{})j("mousemoverel",{})j("mousescroll",{})j("fireclickdetector",{},function()local a9=Instance.new("ClickDetector")fireclickdetector(a9,50,"MouseHoverEnter")end)j("getcallbackvalue",{},function()local aa=Instance.new("BindableFunction")local function j()end;aa.OnInvoke=j;assert(getcallbackvalue(aa,"OnInvoke")==j,"Did not return the correct value")end)j("getconnections",{},function()local W={Enabled="boolean",ForeignState="boolean",LuaConnection="boolean",Function="function",Thread="thread",Fire="function",Defer="function",Disconnect="function",Disable="function",Enable="function"}local aa=Instance.new("BindableEvent")aa.Event:Connect(function()end)local ab=getconnections(aa.Event)[1]for B,C in pairs(W)do assert(ab[B]~=nil,"Did not return a table with a '"..B.."' field")assert(type(ab[B])==C,"Did not return a table with "..B.." as a "..C.." (got "..type(ab[B])..")")end end)j("getcustomasset",{},function()writefile(".tests/getcustomasset.txt","success")local ac=getcustomasset(".tests/getcustomasset.txt")assert(type(ac)=="string","Did not return a string")assert(#ac>0,"Returned an empty string")assert(string.match(ac,"rbxasset://")=="rbxasset://","Did not return an rbxasset url")end)j("gethiddenproperty",{},function()local v=Instance.new("Fire")local ad,ae=gethiddenproperty(v,"size_xml")assert(ad==5,"Did not return the correct value")assert(ae==true,"Did not return whether the property was hidden")end)j("sethiddenproperty",{},function()local v=Instance.new("Fire")local af=sethiddenproperty(v,"size_xml",10)assert(af,"Did not return true for the hidden property")assert(gethiddenproperty(v,"size_xml")==10,"Did not set the hidden property")end)j("gethui",{},function()assert(typeof(gethui())=="Instance","Did not return an Instance")end)j("getinstances",{},function()assert(getinstances()[1]:IsA("Instance"),"The first value is not an Instance")end)j("getnilinstances",{},function()assert(getnilinstances()[1]:IsA("Instance"),"The first value is not an Instance")assert(getnilinstances()[1].Parent==nil,"The first value is not parented to nil")end)j("isscriptable",{},function()local v=Instance.new("Fire")assert(isscriptable(v,"size_xml")==false,"Did not return false for a non-scriptable property (size_xml)")assert(isscriptable(v,"Size")==true,"Did not return true for a scriptable property (Size)")end)j("setscriptable",{},function()local v=Instance.new("Fire")local ag=setscriptable(v,"size_xml",true)assert(ag==false,"Did not return false for a non-scriptable property (size_xml)")assert(isscriptable(v,"size_xml")==true,"Did not set the scriptable property")v=Instance.new("Fire")assert(isscriptable(v,"size_xml")==false,"⚠️⚠️ setscriptable persists between unique instances ⚠️⚠️")end)j("setrbxclipboard",{})j("getrawmetatable",{},function()local ah={__metatable="Locked!"}local ai=setmetatable({},ah)assert(getrawmetatable(ai)==ah,"Did not return the metatable")end)j("hookmetamethod",{},function()local ai=setmetatable({},{__index=newcclosure(function()return false end),__metatable="Locked!"})local H=hookmetamethod(ai,"__index",function()return true end)assert(ai.test==true,"Failed to hook a metamethod and change the return value")assert(H()==false,"Did not return the original function")end)j("getnamecallmethod",{},function()local aj;local H;H=hookmetamethod(game,"__namecall",function(...)if not aj then aj=getnamecallmethod()end;return H(...)end)game:GetService("Lighting")assert(aj=="GetService","Did not get the correct method (GetService)")end)j("isreadonly",{},function()local ai={}table.freeze(ai)assert(isreadonly(ai),"Did not return true for a read-only table")end)j("setrawmetatable",{},function()local ai=setmetatable({},{__index=function()return false end,__metatable="Locked!"})local ak=setrawmetatable(ai,{__index=function()return true end})assert(ai,"Did not return the original object")assert(ai.test==true,"Failed to change the metatable")if ak then return ak==ai and"Returned the original object"or"Did not return the original object"end end)j("setreadonly",{},function()local ai={success=false}table.freeze(ai)setreadonly(ai,false)ai.success=true;assert(ai.success,"Did not allow the table to be modified")end)j("identifyexecutor",{"getexecutorname"},function()local h,al=identifyexecutor()assert(type(h)=="string","Did not return a string for the name")return type(al)=="string"and"Returns version as a string"or"Does not return version"end)j("lz4compress",{},function()local am="Hello, world!"local an=lz4compress(am)assert(type(an)=="string","Compression did not return a string")assert(lz4decompress(an,#am)==am,"Decompression did not return the original string")end)j("lz4decompress",{},function()local am="Hello, world!"local an=lz4compress(am)assert(type(an)=="string","Compression did not return a string")assert(lz4decompress(an,#am)==am,"Decompression did not return the original string")end)j("messagebox",{})j("queue_on_teleport",{"queueonteleport"})j("request",{"http.request","http_request"},function()local ao=request({Url="https://httpbin.org/user-agent",Method="GET"})assert(type(ao)=="table","Response must be a table")assert(ao.StatusCode==200,"Did not return a 200 status code")local ap=game:GetService("HttpService"):JSONDecode(ao.Body)assert(type(ap)=="table"and type(ap["user-agent"])=="string","Did not return a table with a user-agent key")return"User-Agent: "..ap["user-agent"]end)j("setclipboard",{"toclipboard"})j("setfpscap",{},function()local aq=game:GetService("RunService").RenderStepped;local function ar()aq:Wait()local as=0;for p=1,5 do as=as+1/aq:Wait()end;return math.round(as/5)end;setfpscap(60)local at=ar()setfpscap(0)local au=ar()return at.."fps @60 • "..au.."fps @0"end)j("getgc",{},function()local av=getgc()assert(type(av)=="table","Did not return a table")assert(#av>0,"Did not return a table with any values")end)j("getgenv",{},function()getgenv().__TEST_GLOBAL=true;assert(__TEST_GLOBAL,"Failed to set a global variable")getgenv().__TEST_GLOBAL=nil end)j("getloadedmodules",{},function()local aw=getloadedmodules()assert(type(aw)=="table","Did not return a table")assert(#aw>0,"Did not return a table with any values")assert(typeof(aw[1])=="Instance","First value is not an Instance")assert(aw[1]:IsA("ModuleScript"),"First value is not a ModuleScript")end)j("getrenv",{},function()assert(_G~=getrenv()._G,"The variable _G in the executor is identical to _G in the game")end)j("getrunningscripts",{},function()local ax=getrunningscripts()assert(type(ax)=="table","Did not return a table")assert(#ax>0,"Did not return a table with any values")assert(typeof(ax[1])=="Instance","First value is not an Instance")assert(ax[1]:IsA("ModuleScript")or ax[1]:IsA("LocalScript"),"First value is not a ModuleScript or LocalScript")end)j("getscriptbytecode",{"dumpstring"},function()local I=game:GetService("Players").LocalPlayer.Character.Animate;local J=getscriptbytecode(I)assert(type(J)=="string","Did not return a string for Character.Animate (a "..I.ClassName..")")end)j("getscripthash",{},function()local I=game:GetService("Players").LocalPlayer.Character.Animate:Clone()local U=getscripthash(I)local ay=I.Source;I.Source="print('Hello, world!')"task.defer(function()I.Source=ay end)local az=getscripthash(I)assert(U~=az,"Did not return a different hash for a modified script")assert(az==getscripthash(I),"Did not return the same hash for a script with the same source")end)j("getscripts",{},function()local ax=getscripts()assert(type(ax)=="table","Did not return a table")assert(#ax>0,"Did not return a table with any values")assert(typeof(ax[1])=="Instance","First value is not an Instance")assert(ax[1]:IsA("ModuleScript")or ax[1]:IsA("LocalScript"),"First value is not a ModuleScript or LocalScript")end)j("getsenv",{},function()local I=game:GetService("Players").LocalPlayer.Character.Animate;local aA=getsenv(I)assert(type(aA)=="table","Did not return a table for Character.Animate (a "..I.ClassName..")")assert(aA.script==I,"The script global is not identical to Character.Animate")end)j("getthreadidentity",{"getidentity","getthreadcontext"},function()assert(type(getthreadidentity())=="number","Did not return a number")end)j("setthreadidentity",{"setidentity","setthreadcontext"},function()setthreadidentity(3)assert(getthreadidentity()==3,"Did not set the thread identity")end)j("Drawing",{})j("Drawing.new",{},function()local aB=Drawing.new("Square")aB.Visible=false;local aC=pcall(function()aB:Destroy()end)assert(aC,"Drawing:Destroy() should not throw an error")end)j("Drawing.Fonts",{},function()assert(Drawing.Fonts.UI==0,"Did not return the correct id for UI")assert(Drawing.Fonts.System==1,"Did not return the correct id for System")assert(Drawing.Fonts.Plex==2,"Did not return the correct id for Plex")assert(Drawing.Fonts.Monospace==3,"Did not return the correct id for Monospace")end)j("isrenderobj",{},function()local aB=Drawing.new("Image")aB.Visible=true;assert(isrenderobj(aB)==true,"Did not return true for an Image")assert(isrenderobj(newproxy())==false,"Did not return false for a blank table")end)j("getrenderproperty",{},function()local aB=Drawing.new("Image")aB.Visible=true;assert(type(getrenderproperty(aB,"Visible"))=="boolean","Did not return a boolean value for Image.Visible")local m,aD=pcall(function()return getrenderproperty(aB,"Color")end)if not m or not aD then return"Image.Color is not supported"end end)j("setrenderproperty",{},function()local aB=Drawing.new("Square")aB.Visible=true;setrenderproperty(aB,"Visible",false)assert(aB.Visible==false,"Did not set the value for Square.Visible")end)j("cleardrawcache",{},function()cleardrawcache()end)j("WebSocket",{})j("WebSocket.connect",{},function()local W={Send="function",Close="function",OnMessage={"table","userdata"},OnClose={"table","userdata"}}local aE=WebSocket.connect("ws://echo.websocket.events")assert(type(aE)=="table"or type(aE)=="userdata","Did not return a table or userdata")for B,C in pairs(W)do if type(C)=="table"then assert(table.find(C,type(aE[B])),"Did not return a "..table.concat(C,", ").." for "..B.." (a "..type(aE[B])..")")else assert(type(aE[B])==C,"Did not return a "..C.." for "..B.." (a "..type(aE[B])..")")end end;aE:Close()end)
Add Comment
Please, Sign In to add comment