return function()local a=script.Parent local w=require(a["\116\101\115\116\111\117\116\112\117\116\049\046\103\101\110"])local B=require(a.escapeString)local b=require(a.Parent)local function V(a)if a:len()>80 then a=a:sub(1,76).." \046\046\046"end return B(a)end for a,w in pairs(w)do local B=("\114\101\103\101\120 \096\037\115\096\037\115"):format(V(w.source),w.flags==nil and""or("\119\105\116\104 \037\115 \102\108\097\103\115"):format(w.flags))describe(B,function()local a=nil beforeEach(function()a=b.new(w.source,w.flags)end)for w,B in ipairs(w.tests)do if B.matches==nil then local w=("\100\111\101\115 \110\111\116 \109\097\116\099\104 \119\105\116\104 \096\037\115\096 \040\108\101\110\058 \037\100\041"):format(B.input,B.input:len())it(w,function()(expect(a:match(B.input))).to.equal(nil)end)else describe(("\109\097\116\099\104\101\115 \119\105\116\104 \096\037\115\096"):format(B.input),function()local w=nil beforeEach(function()w=a:match(B.input)end)for a,B in ipairs(B.matches)do local b=("\109\097\116\099\104 \035\037\100 \105\115 \096\037\115\096"):format(B.index,B.match)it(b,function()(expect(w)).to.be.ok()local a=B.match if a=="\060\117\110\115\101\116\062"then a=nil end;(expect(w:group(B.index))).to.equal(a)end)end end)end end end)end end
return function()
	local __tests__ = script.Parent
	local testData = require(__tests__["testoutput1.gen"])
	local escapeString = require(__tests__.escapeString)
	local RegEx = require(__tests__.Parent)

	local function shortenIfTooLong(str)
		if str:len() > 80 then
			str = str:sub(1, 76) .. " ..."
		end
		return escapeString(str)
	end

	for _, case in pairs(testData) do
		local message = ("regex `%s`%s"):format(
			shortenIfTooLong(case.source),
			case.flags == nil and "" or ("with %s flags"):format(case.flags)
		)
		describe(message, function()
			local regex = nil
			beforeEach(function()
				regex = RegEx.new(case.source, case.flags)
			end)

			for _, testCase in ipairs(case.tests) do
				if testCase.matches == nil then
					-- using the length in the test name will dedup tests
					-- where the match is identical except one ends with `\0`
					local testMessage = ("does not match with `%s` (len: %d)"):format(
						testCase.input,
						testCase.input:len()
					)
					it(testMessage, function()
						expect(regex:match(testCase.input)).to.equal(nil)
					end)
				else
					describe(("matches with `%s`"):format(testCase.input), function()
						local matchResults = nil
						beforeEach(function()
							matchResults = regex:match(testCase.input)
						end)

						for _, match in ipairs(testCase.matches) do
							local testMessage = ("match #%d is `%s`"):format(
								match.index,
								match.match
							)
							it(testMessage, function()
								expect(matchResults).to.be.ok()
								local expectedMatch = match.match
								if expectedMatch == "<unset>" then
									expectedMatch = nil
								end
								expect(matchResults:group(match.index)).to.equal(expectedMatch)
							end)
						end
					end)
				end
			end
		end)
	end
end
