local a,O=pcall(game.GetService,game,"\080\114\111\099\101\115\115\083\101\114\118\105\099\101")local function Y(a,O)O=O or{}for a,Y in ipairs(a:GetChildren())do if Y:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then table.insert(O,Y)end end return O end local m,S=xpcall(function()local a=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local O=Y(a.TestEZTests)local m=0 local S=0 local E=0 local w={}for a,O in ipairs(O)do local Y=require(O)print(string.format("\037\115",O.Name))for a,O in pairs(Y)do local Y,A=pcall(O)m=m+1 if Y then print(string.format("  \091\080\065\083\083\093 \037\115",a))E=E+1 else print(string.format("  \091\070\065\073\076\093 \037\115",a))S=S+1 local O=string.format("\084\101\115\116\058 \037\115\n\069\114\114\111\114\058 \037\115",a,A)table.insert(w,O)end end end print()print(string.format("\037\115 \116\101\115\116\115 \114\117\110\058 \037\115 \112\097\115\115\101\100\044 \037\115 \102\097\105\108\101\100",m,E,S))if#w>0 then print()print(table.concat(w,"\n\n"))end return S==0 and 0 or 1 end,debug.traceback)local E local w=nil if m then E=S else E=1 w=S end if __LEMUR__ then if w~=nil then print(w)end os.exit(E)elseif a then if w~=nil then print(w)end O:ExitAsync(E)else if w~=nil then error(w,0)end end
--[[
	This test runner is invoked in all the environments that we want to test our
	library in.

	We target Lemur, Roblox Studio, and Roblox-CLI.
]]

-- luacheck: globals __LEMUR__

local isRobloxCli, ProcessService = pcall(game.GetService, game, "ProcessService")

local function findUnitTests(container, foundTests)
	foundTests = foundTests or {}

	for _, child in ipairs(container:GetChildren()) do
		if child:IsA("ModuleScript") then
			table.insert(foundTests, child)
		end
	end

	return foundTests
end

local completed, result = xpcall(function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

	local testModules = findUnitTests(ReplicatedStorage.TestEZTests)

	local totalCount = 0
	local failureCount = 0
	local successCount = 0
	local errorMessages = {}

	for _, testModule in ipairs(testModules) do
		local tests = require(testModule)

		print(string.format("%s", testModule.Name))

		for testName, testFunction in pairs(tests) do
			local success, message = pcall(testFunction)
			totalCount = totalCount + 1

			if success then
				print(string.format("  [PASS] %s", testName))
				successCount = successCount + 1
			else
				print(string.format("  [FAIL] %s", testName))
				failureCount = failureCount + 1

				local logMessage = string.format("Test: %s\nError: %s", testName, message)
				table.insert(errorMessages, logMessage)
			end
		end
	end

	print()
	print(string.format("%s tests run: %s passed, %s failed", totalCount, successCount, failureCount))

	if #errorMessages > 0 then
		print()
		print(table.concat(errorMessages, "\n\n"))
	end

	return failureCount == 0 and 0 or 1
end, debug.traceback)

local statusCode
local errorMessage = nil
if completed then
	statusCode = result
else
	statusCode = 1
	errorMessage = result
end

if __LEMUR__ then
	-- Lemur has access to normal Lua OS APIs

	if errorMessage ~= nil then
		print(errorMessage)
	end
	os.exit(statusCode)
elseif isRobloxCli then
	-- Roblox CLI has a special service to terminate the process

	if errorMessage ~= nil then
		print(errorMessage)
	end
	ProcessService:ExitAsync(statusCode)
else
	-- In Studio, we can just throw an error to get the user's attention

	if errorMessage ~= nil then
		error(errorMessage, 0)
	end
end
