local passes, fails, undefined = 0, 0, 0 local running = 1 local uncTestV2 = {} uncTestV2.getGlobal = function(path) local value = getfenv(0) while value ~= nil and path ~= "" do local name, nextValue = string.match(path, "^([^.]+)%.?(.*)$") value = value[name] path = nextValue end return value end uncTestV2.startV1 = function(name, aliases, callback) running += 1 task.spawn(function() if not callback then print("⏺️ " .. name) elseif not uncTestV2.getGlobal(name) then fails += 1 warn("⛔ " .. name) else local success, message = pcall(callback) if success then passes += 1 print("✅ " .. name .. (message and " • " .. message or "")) else fails += 1 warn("⛔ " .. name .. " failed: " .. message) end end local undefinedAliases = {} for _, alias in ipairs(aliases) do if uncTestV2.getGlobal(alias) == nil then table.insert(undefinedAliases, alias) end end if #undefinedAliases > 0 then undefined += 1 warn("⚠️ " .. table.concat(undefinedAliases, ", ")) end running -= 1 end) end uncTestV2.startV2 = function(name, allTests, callback) running += 1 local passesUNC, failsUNC = 0, 0 local runningUNC = 0 print('⏲️ ' .. name) for a, b in ipairs(allTests) do for i, v in pairs(b) do runningUNC += 1 if not v then error('Missing UNC Name') end if not v.Callback then print(' • ⏺️ ' .. v.Name) elseif v.IsGlobal and v.Name and not uncTestV2.getGlobal(v.Name) then warn(' • ⚠️ ' .. v.Name) failsUNC += 1 else local success, message = pcall(v.Callback) if success then passesUNC += 1 print(" • ✅ " .. v.Name .. (message and " • " .. message or "")) else failsUNC += 1 warn(" • ⛔ " .. v.Name .. " failed: " .. message) end end runningUNC -= 1 repeat task.wait(0.05) until runningUNC == 0 end end local success, result if callback then success, result = pcall(callback) end local mes = (name .. ' • ' .. (passesUNC .. ' / ' .. (failsUNC + passesUNC))) if failsUNC > 0 and passesUNC > 0 then warn('⚠️ ' .. mes) elseif failsUNC == 0 then passes += passesUNC print('✅ ' .. mes) elseif passesUNC == 0 then fails += failsUNC warn('⛔ ' .. mes) end running -= 1 end print("\n") print("UNC V2 Environment Check") print("✅ - Pass, ⛔ - Fail, ⏺️ - No test, ⚠️ - Missing aliases\n") task.defer(function() repeat task.wait() until running == 0 local rate = math.round(passes / (passes + fails) * 100) local outOf = passes .. " out of " .. (passes + fails) print("\n") print("UNC V2 Summary") print("✅ Tested with a " .. rate .. "% success rate (" .. outOf .. ")") print("⛔ " .. fails .. " tests failed") print("⚠️ " .. undefined .. " globals are missing aliases") end) uncTestV2.startV2('firedetectors', { { { Name = 'fireclickdetector', IsGlobal = true, Callback = function() local detector = Instance.new('ClickDetector') fireclickdetector(detector) end, }, { Name = 'firetouchinterest', IsGlobal = true, Callback = function() local Part = Instance.new('Part') Part.Parent = workspace Part.Touched:Connect(function() end) local a,b=pcall(function() repeat task.wait(0.5) until Part:FindFirstChildOfClass('TouchTransmitter') local plr = game:GetService('Players').LocalPlayer firetouchinterest(Part, (plr.Character or plr.CharacterAdded:Wait()):WaitForChild('HumanoidRootPart'), 0) firetouchinterest(Part, (plr.Character or plr.CharacterAdded:Wait()):WaitForChild('HumanoidRootPart'), 1) end) if not a then error(b) end Part:Destroy() end, }, { Name = 'fireproximityprompt', IsGlobal = true, Callback = function() local proximityPrompt = Instance.new('ProximityPrompt') fireproximityprompt(proximityPrompt) end, } } }) if isfolder and makefolder and delfolder then if isfolder('.UNCTestV2') then delfolder('.UNCTestV2') end makefolder('.UNCTestV2') end uncTestV2.startV2('File/Folder System', { { { Name = 'File' }, { Name = 'writefile', IsGlobal = true, Callback = function() writefile('.UNCTestV2/writefile.txt', 'success') assert(readfile('.UNCTestV2/writefile.txt') == 'success', 'Did not write the file') local requiresFileExt = pcall(function() writefile(".UNCTestV2/writefile", "success") assert(isfile(".UNCTestV2/writefile.txt")) end) if not requiresFileExt then return "This executor requires a file extension in writefile" end end, }, { Name = 'readfile', IsGlobal = true, Callback = function() writefile(".UNCTestV2/readfile.txt", "success") assert(readfile(".UNCTestV2/readfile.txt") == "success", "Did not return the contents of the file") end, }, { Name = 'listfiles', IsGlobal = true, Callback = function() makefolder(".UNCTestV2/listfiles") writefile(".UNCTestV2/listfiles/test_1.txt", "success") writefile(".UNCTestV2/listfiles/test_2.txt", "success") local files = listfiles(".UNCTestV2/listfiles") assert(#files == 2, "Did not return the correct number of files") assert(isfile(files[1]), "Did not return a file path") assert(readfile(files[1]) == "success", "Did not return the correct files") makefolder(".UNCTestV2/listfiles_2") makefolder(".UNCTestV2/listfiles_2/test_1") makefolder(".UNCTestV2/listfiles_2/test_2") local folders = listfiles(".UNCTestV2/listfiles_2") assert(#folders == 2, "Did not return the correct number of folders") assert(isfolder(folders[1]), "Did not return a folder path") end, }, { Name = 'appendfile', IsGlobal = true, Callback = function() writefile(".UNCTestV2/appendfile.txt", "su") appendfile(".UNCTestV2/appendfile.txt", "cce") appendfile(".UNCTestV2/appendfile.txt", "ss") assert(readfile(".UNCTestV2/appendfile.txt") == "success", "Did not append the file") end, }, { Name = 'isfile', IsGlobal = true, Callback = function() writefile(".UNCTestV2/isfile.txt", "success") assert(isfile(".UNCTestV2/isfile.txt") == true, "Did not return true for a file") assert(isfile(".UNCTestV2") == false, "Did not return false for a folder") assert(isfile(".UNCTestV2/doesnotexist.exe") == false, "Did not return false for a nonexistent path (got " .. tostring(isfile(".UNCTestV2/doesnotexist.exe")) .. ")") end, }, { Name = 'delfile', IsGlobal = true, Callback = function() writefile(".UNCTestV2/delfile.txt", "Hello, world!") delfile(".UNCTestV2/delfile.txt") assert(isfile(".UNCTestV2/delfile.txt") == false, "Failed to delete file (isfile = " .. tostring(isfile(".tests/delfile.txt")) .. ")") end, }, { Name = 'loadfile', IsGlobal = true, Callback = function() -- Write a valid Lua script to a file writefile(".UNCTestV2/loadfile.txt", "local r=({...})[1]; return ({pcall(function(r) return r + 1 end, r)})[2]") local a,b = pcall(function() -- Load the file and execute it with arguments assert(assert(loadfile(".UNCTestV2/loadfile.txt"))(1) == 2, "Failed to load a file with arguments") end) assert(a == true or b:find('Incomplete statement: expected assignment or a function call'), b) -- Write an invalid Lua script to the file to test error handling writefile(".UNCTestV2/loadfile.txt", "f") -- Invalid Lua syntax -- Attempt to load the file and check for an error local callback, err = loadfile(".UNCTestV2/loadfile.txt") assert(err and not callback, "Did not return an error message for a compiler error") end, }, { Name = 'dofile' }, { Name = 'Folder' }, { Name = 'makefolder', IsGlobal = true, Callback = function() makefolder(".UNCTestV2/makefolder") assert(isfolder(".UNCTestV2/makefolder"), "Did not create the folder") end, }, { Name = 'isfolder', IsGlobal = true, Callback = function() assert(isfolder(".UNCTestV2") == true, "Did not return false for a folder") assert(isfolder(".UNCTestV2/doesnotexist.exe") == false, "Did not return false for a nonexistent path (got " .. tostring(isfolder(".tests/doesnotexist.exe")) .. ")") end, }, { Name = 'delfolder', IsGlobal = true, Callback = function() makefolder(".UNCTestV2/delfolder") delfolder(".UNCTestV2/delfolder") assert(isfolder(".UNCTestV2/delfolder") == false, "Failed to delete folder (isfolder = " .. tostring(isfolder(".tests/delfolder")) .. ")") end, } } }) uncTestV2.startV1('Game Controll', {}) uncTestV2.startV2('Players', { { { Name = 'ReportAbuse', IsGlobal = false, Callback = function() local PlayerService = game:GetService('Players') local a,b = pcall(function() PlayerService:ReportAbuse(PlayerService.LocalPlayer) end) assert(a, 'There is almost no reason for this function to be blocked!') return 'Successfully Passed the TEST!' end, }, { Name = 'ReportAbuseV3', IsGlobal = false, Callback = function() local PlayerService = game:GetService('Players') local a,b = pcall(function() PlayerService:ReportAbuseV3(PlayerService.LocalPlayer) end) assert(a, 'There is almost no reason for this function to be blocked!') return 'Successfully Passed the TEST!' end, } } }) uncTestV2.startV2('UserInputService', { { { Name = 'GetPlatform', IsGlobal = false, Callback = function() local UTS = game:GetService('UserInputService') return 'Player Platform: ' .. tostring(UTS:GetPlatform() and UTS:GetPlatform().Name) end, } } }) uncTestV2.startV2('TestService', { { { Name = 'Require', IsGlobal = false, Callback = function() game:GetService('TestService'):Require(true, 'Successfully did test!', game:GetService('Players').LocalPlayer:WaitForChild('PlayerScripts').PlayerModule) end, } } }) uncTestV2.startV2('ScriptContext', { { { Name = 'AddCoreScriptLocal', IsGlobal = false, Callback = function() local a,b=pcall(function() return game:GetService('ScriptContext'):AddCoreScriptLocal('CoreScripts/AvatarContextMenu', game:GetService('CoreGui').RobloxGui) end) assert(a, 'Function can only add pre-exstining CoreScripts! You cannot change the CoreScripts! NO REASON TO BE BLOCKED! ' .. tostring(b)) end, } } }) running -= 1